-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.js
59 lines (51 loc) · 2.04 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
var safariURL = "//github.com/CatBlock/catblock/releases/download/v1.5.1/catblock-safari.safariextz";
var firefoxURL = "//addons.mozilla.org/firefox/addon/adblock-with-catblock/";
var chromeURL = "//chrome.google.com/webstore/detail/catblock/mdcgnhlfpnbeieiiccmebgkfdebafodo"
$(document).ready(function() {
"use strict";
var leftdiv = document.getElementById("leftrow");
var rightdiv = document.getElementById("rightrow");
function resize(width) {
if (width < 985) {
$(rightdiv).css("display", "none").removeClass("col-xs-4");
$(leftdiv).removeClass("col-xs-8");
} else {
$(rightdiv).css("display", "block").addClass("col-xs-4");
$(leftdiv).addClass("col-xs-8");
}
}
// Resize divs properly
resize($(window).width());
$(window).resize(function() {
var width = $(window).width();
resize(width);
});
// Let's detect the browser, and show a Safari downloads link if it's unsupported
var chrome = window.chrome;
var opera = window.opr;
var safari = window.safari;
var edge = chrome && (navigator.userAgent.indexOf("Edge") > -1);
var firefox = navigator.userAgent.indexOf("Firefox") > -1;
var $DLbutton = $("#downloadbtn");
if (opera) {
$DLbutton.text("Install CatBlock meow!");
$DLbutton.click(function() {
opr.addons.installExtension("pejeadkbfbppoaoinpmkeonebmngpnkk");
});
} else if (chrome && !edge) {
$DLbutton.text("Install CatBlock meow!");
$DLbutton.click(function() {
$DLbutton.attr("href", chromeURL);
});
} else if (safari) {
$DLbutton.text("Install CatBlock meow!");
$DLbutton.attr("href", safariURL);
} else if (firefox) {
$DLbutton.text("Install CatBlock meow!");
$DLbutton.attr("href", firefoxURL);
} else {
$DLbutton.removeClass("btn-success").addClass("btn-failure");
$DLbutton.text("CatBlock is not available for your browser.");
$DLbutton.attr("href", "#");
}
});