mirror of
https://github.com/privacyguides/privacyguides.org.git
synced 2025-07-21 10:52:41 +00:00
Move privacytools.io files to privacytools.io directory
This commit is contained in:
6
privacytools.io/assets/js/applytheme.js
Normal file
6
privacytools.io/assets/js/applytheme.js
Normal file
@ -0,0 +1,6 @@
|
||||
if (localStorage.getItem("colorScheme") === "dark") {
|
||||
document.querySelector("#dark-css").removeAttribute("media"); // Set dark theme
|
||||
}
|
||||
else if (localStorage.getItem("colorScheme") === "light") {
|
||||
document.querySelector("#dark-css").setAttribute("media", "invalid"); // Set light theme
|
||||
}
|
6
privacytools.io/assets/js/bootstrap.min.js
vendored
Normal file
6
privacytools.io/assets/js/bootstrap.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
2
privacytools.io/assets/js/jquery-3.3.1.min.js
vendored
Normal file
2
privacytools.io/assets/js/jquery-3.3.1.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
96
privacytools.io/assets/js/main.js
Normal file
96
privacytools.io/assets/js/main.js
Normal file
@ -0,0 +1,96 @@
|
||||
$(function() {
|
||||
$("[data-toggle='tooltip']").tooltip();
|
||||
});
|
||||
document.querySelectorAll(".onclick-select").forEach(element => {
|
||||
element.addEventListener("click", element.select);
|
||||
});
|
||||
|
||||
|
||||
// Navbar dropdowns
|
||||
const navSections = document.querySelectorAll(".nav-details");
|
||||
|
||||
navSections.forEach(navSection => {
|
||||
navSection.addEventListener("toggle", navSectionsToggle);
|
||||
});
|
||||
document.addEventListener("click", navSectionsClose);
|
||||
|
||||
function navSectionsToggle() {
|
||||
// When opening next dropdown, hide previous
|
||||
if (this.open) {
|
||||
navSections.forEach(navSection => {
|
||||
if (navSection != this && navSection.open) navSection.open = !open;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function navSectionsClose(event) {
|
||||
// Hide all dropdowns when clicking in different place
|
||||
if (
|
||||
event.target.matches(".nav-summary") ||
|
||||
event.target.parentNode.matches(".nav-summary")
|
||||
)
|
||||
return;
|
||||
navSections.forEach(navSection => {
|
||||
navSection.open = !open;
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
// Dark/Light color scheme switch button
|
||||
document.querySelector("#nav-switch-theme").style.display = "inline";
|
||||
document.querySelector("#nav-switch-theme").addEventListener("click", changeColorScheme);
|
||||
|
||||
function changeColorScheme() {
|
||||
// Use whatever users want
|
||||
if (localStorage.getItem("colorScheme") === "dark") {
|
||||
// Change to light theme
|
||||
if (window.matchMedia("(prefers-color-scheme: dark)").matches === false) {
|
||||
document.querySelector("#dark-css").setAttribute("media", "(prefers-color-scheme: dark)");
|
||||
localStorage.removeItem("colorScheme");
|
||||
} else {
|
||||
// by setting invalid media it will just not apply CSS for anyone
|
||||
document.querySelector("#dark-css").setAttribute("media", "invalid");
|
||||
localStorage.setItem("colorScheme", "light");
|
||||
}
|
||||
}
|
||||
// Change to dark theme
|
||||
else if (localStorage.getItem("colorScheme") === "light") {
|
||||
if (window.matchMedia("(prefers-color-scheme: dark)").matches === true) {
|
||||
document.querySelector("#dark-css").setAttribute("media", "(prefers-color-scheme: dark)");
|
||||
localStorage.removeItem("colorScheme");
|
||||
} else {
|
||||
// media was set to prefers-color-scheme: dark
|
||||
document.querySelector("#dark-css").removeAttribute("media");
|
||||
localStorage.setItem("colorScheme", "dark");
|
||||
}
|
||||
}
|
||||
|
||||
// Just use whatever browsers want
|
||||
else if (window.matchMedia("(prefers-color-scheme: dark)").matches === true) {
|
||||
// Change to light Theme
|
||||
document.querySelector("#dark-css").setAttribute("media", "invalid");
|
||||
localStorage.setItem("colorScheme", "light");
|
||||
} else {
|
||||
// Change to dark theme
|
||||
document.querySelector("#dark-css").removeAttribute("media");
|
||||
localStorage.setItem("colorScheme", "dark");
|
||||
}
|
||||
fixThemeImages();
|
||||
}
|
||||
|
||||
|
||||
// Fix images in dark theme
|
||||
function fixThemeImages() {
|
||||
document.querySelectorAll('[data-theme-src]').forEach(function(image) {
|
||||
tempSrc = image.src;
|
||||
image.src = image.getAttribute("data-theme-src");
|
||||
image.setAttribute("data-theme-src", tempSrc);
|
||||
});
|
||||
}
|
||||
if (
|
||||
(localStorage.getItem("colorScheme") === "dark") ||
|
||||
(window.matchMedia("(prefers-color-scheme: dark)").matches ^
|
||||
localStorage.getItem("colorScheme") === "light")
|
||||
) {
|
||||
fixThemeImages();
|
||||
}
|
4
privacytools.io/assets/js/popper.min.js
vendored
Normal file
4
privacytools.io/assets/js/popper.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
33
privacytools.io/assets/js/redirects.js
Normal file
33
privacytools.io/assets/js/redirects.js
Normal file
@ -0,0 +1,33 @@
|
||||
if (window.location == 'https://www.privacytools.io/#ukusa') { window.location = 'https://www.privacytools.io/providers/';}
|
||||
if (window.location == 'https://www.privacytools.io/#vpn') { window.location = 'https://www.privacytools.io/providers/vpn/';}
|
||||
if (window.location == 'https://www.privacytools.io/#email') { window.location = 'https://www.privacytools.io/providers/email/';}
|
||||
if (window.location == 'https://www.privacytools.io/#cloud') { window.location = 'https://www.privacytools.io/providers/cloud-storage/';}
|
||||
if (window.location == 'https://www.privacytools.io/#social') { window.location = 'https://www.privacytools.io/providers/social-networks/';}
|
||||
if (window.location == 'https://www.privacytools.io/#dns') { window.location = 'https://www.privacytools.io/providers/dns/';}
|
||||
if (window.location == 'https://www.privacytools.io/#search') { window.location = 'https://www.privacytools.io/providers/search-engines/';}
|
||||
if (window.location == 'https://www.privacytools.io/#host') { window.location = 'https://www.privacytools.io/providers/hosting/';}
|
||||
if (window.location == 'https://www.privacytools.io/#paste') { window.location = 'https://www.privacytools.io/providers/paste';}
|
||||
if (window.location == 'https://www.privacytools.io/#browser') { window.location = 'https://www.privacytools.io/browsers/';}
|
||||
if (window.location == 'https://www.privacytools.io/#fingerprint') { window.location = 'https://www.privacytools.io/browsers/#fingerprint';}
|
||||
if (window.location == 'https://www.privacytools.io/#webrtc') { window.location = 'https://www.privacytools.io/browsers/#webrtc';}
|
||||
if (window.location == 'https://www.privacytools.io/#addons') { window.location = 'https://www.privacytools.io/browsers/#addons';}
|
||||
if (window.location == 'https://www.privacytools.io/#about_config') { window.location = 'https://www.privacytools.io/browsers/#about_config';}
|
||||
if (window.location == 'https://www.privacytools.io/#clients') { window.location = 'https://www.privacytools.io/software/email/';}
|
||||
if (window.location == 'https://www.privacytools.io/#messaging') { window.location = 'https://www.privacytools.io/software/email/#messaging';}
|
||||
if (window.location == 'https://www.privacytools.io/#im') { window.location = 'https://www.privacytools.io/software/im/';}
|
||||
if (window.location == 'https://www.privacytools.io/#voip') { window.location = 'https://www.privacytools.io/software/voip/';}
|
||||
if (window.location == 'https://www.privacytools.io/#filesharing') { window.location = 'https://www.privacytools.io/software/file-sharing/';}
|
||||
if (window.location == 'https://www.privacytools.io/#mycloud') { window.location = 'https://www.privacytools.io/software/cloud/';}
|
||||
if (window.location == 'https://www.privacytools.io/#sync') { window.location = 'https://www.privacytools.io/software/file-sync/';}
|
||||
if (window.location == 'https://www.privacytools.io/#pw') { window.location = 'https://www.privacytools.io/software/passwords/';}
|
||||
if (window.location == 'https://www.privacytools.io/#calendar_contacts') { window.location = 'https://www.privacytools.io/software/calendar-contacts/';}
|
||||
if (window.location == 'https://www.privacytools.io/#encrypt') { window.location = 'https://www.privacytools.io/software/encryption-tools/';}
|
||||
if (window.location == 'https://www.privacytools.io/#darknets') { window.location = 'https://www.privacytools.io/software/networks/';}
|
||||
if (window.location == 'https://www.privacytools.io/#notebook') { window.location = 'https://www.privacytools.io/software/notebooks/';}
|
||||
if (window.location == 'https://www.privacytools.io/#productivity') { window.location = 'https://www.privacytools.io/software/productivity/';}
|
||||
if (window.location == 'https://www.privacytools.io/#os') { window.location = 'https://www.privacytools.io/operating-systems/';}
|
||||
if (window.location == 'https://www.privacytools.io/#live_os') { window.location = 'https://www.privacytools.io/operating-systems/#live_os';}
|
||||
if (window.location == 'https://www.privacytools.io/#mobile_os') { window.location = 'https://www.privacytools.io/operating-systems/#mobile_os';}
|
||||
if (window.location == 'https://www.privacytools.io/#aaddons') { window.location = 'https://www.privacytools.io/operating-systems/#aaddons';}
|
||||
if (window.location == 'https://www.privacytools.io/#firmware') { window.location = 'https://www.privacytools.io/operating-systems/#firmware';}
|
||||
if (window.location == 'https://www.privacytools.io/#win10') { window.location = 'https://www.privacytools.io/operating-systems/#win10';}
|
145
privacytools.io/assets/js/sortable.js
Normal file
145
privacytools.io/assets/js/sortable.js
Normal file
@ -0,0 +1,145 @@
|
||||
(function() {
|
||||
var SELECTOR, clickEvent, numberRegExp, sortable, touchDevice, trimRegExp;
|
||||
|
||||
SELECTOR = 'table[data-sortable]';
|
||||
|
||||
numberRegExp = /^-?[£$¤]?[\d,.]+%?$/;
|
||||
|
||||
trimRegExp = /^\s+|\s+$/g;
|
||||
|
||||
touchDevice = 'ontouchstart' in document.documentElement;
|
||||
|
||||
clickEvent = touchDevice ? 'touchstart' : 'click';
|
||||
|
||||
sortable = {
|
||||
init: function() {
|
||||
var table, tables, _i, _len, _results;
|
||||
tables = document.querySelectorAll(SELECTOR);
|
||||
_results = [];
|
||||
for (_i = 0, _len = tables.length; _i < _len; _i++) {
|
||||
table = tables[_i];
|
||||
_results.push(sortable.initTable(table));
|
||||
}
|
||||
return _results;
|
||||
},
|
||||
initTable: function(table) {
|
||||
var i, th, ths, _i, _len;
|
||||
if (table.tHead.rows.length !== 1) {
|
||||
return;
|
||||
}
|
||||
if (table.getAttribute('data-sortable-initialized') === 'true') {
|
||||
return;
|
||||
}
|
||||
table.setAttribute('data-sortable-initialized', 'true');
|
||||
ths = table.querySelectorAll('th');
|
||||
for (i = _i = 0, _len = ths.length; _i < _len; i = ++_i) {
|
||||
th = ths[i];
|
||||
if (th.getAttribute('data-sortable') !== 'false') {
|
||||
sortable.setupClickableTH(table, th, i);
|
||||
}
|
||||
}
|
||||
return table;
|
||||
},
|
||||
setupClickableTH: function(table, th, i) {
|
||||
var type;
|
||||
type = sortable.getColumnType(table, i);
|
||||
return th.addEventListener(clickEvent, function(e) {
|
||||
var newSortedDirection, row, rowArray, rowArrayObject, sorted, sortedDirection, tBody, ths, _i, _j, _k, _len, _len1, _len2, _ref, _results;
|
||||
sorted = this.getAttribute('data-sorted') === 'true';
|
||||
sortedDirection = this.getAttribute('data-sorted-direction');
|
||||
if (sorted) {
|
||||
newSortedDirection = sortedDirection === 'ascending' ? 'descending' : 'ascending';
|
||||
} else {
|
||||
newSortedDirection = type.defaultSortDirection;
|
||||
}
|
||||
ths = this.parentNode.querySelectorAll('th');
|
||||
for (_i = 0, _len = ths.length; _i < _len; _i++) {
|
||||
th = ths[_i];
|
||||
th.setAttribute('data-sorted', 'false');
|
||||
th.removeAttribute('data-sorted-direction');
|
||||
}
|
||||
this.setAttribute('data-sorted', 'true');
|
||||
this.setAttribute('data-sorted-direction', newSortedDirection);
|
||||
tBody = table.tBodies[0];
|
||||
rowArray = [];
|
||||
_ref = tBody.rows;
|
||||
for (_j = 0, _len1 = _ref.length; _j < _len1; _j++) {
|
||||
row = _ref[_j];
|
||||
rowArray.push([sortable.getNodeValue(row.cells[i]), row]);
|
||||
}
|
||||
if (sorted) {
|
||||
rowArray.reverse();
|
||||
} else {
|
||||
rowArray.sort(type.compare);
|
||||
}
|
||||
_results = [];
|
||||
for (_k = 0, _len2 = rowArray.length; _k < _len2; _k++) {
|
||||
rowArrayObject = rowArray[_k];
|
||||
_results.push(tBody.appendChild(rowArrayObject[1]));
|
||||
}
|
||||
return _results;
|
||||
});
|
||||
},
|
||||
getColumnType: function(table, i) {
|
||||
var row, text, _i, _len, _ref;
|
||||
_ref = table.tBodies[0].rows;
|
||||
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
||||
row = _ref[_i];
|
||||
text = sortable.getNodeValue(row.cells[i]);
|
||||
if (text !== '' && text.match(numberRegExp)) {
|
||||
return sortable.types.numeric;
|
||||
}
|
||||
}
|
||||
return sortable.types.alpha;
|
||||
},
|
||||
getNodeValue: function(node) {
|
||||
if (!node) {
|
||||
return '';
|
||||
}
|
||||
if (node.getAttribute('data-value') !== null) {
|
||||
return node.getAttribute('data-value');
|
||||
}
|
||||
if (typeof node.innerText !== 'undefined') {
|
||||
return node.innerText.replace(trimRegExp, '');
|
||||
}
|
||||
return node.textContent.replace(trimRegExp, '');
|
||||
},
|
||||
types: {
|
||||
numeric: {
|
||||
defaultSortDirection: 'descending',
|
||||
compare: function(a, b) {
|
||||
var aa, bb;
|
||||
aa = parseFloat(a[0].replace(/[^0-9.-]/g, ''));
|
||||
bb = parseFloat(b[0].replace(/[^0-9.-]/g, ''));
|
||||
if (isNaN(aa)) {
|
||||
aa = 0;
|
||||
}
|
||||
if (isNaN(bb)) {
|
||||
bb = 0;
|
||||
}
|
||||
return bb - aa;
|
||||
}
|
||||
},
|
||||
alpha: {
|
||||
defaultSortDirection: 'ascending',
|
||||
compare: function(a, b) {
|
||||
var aa, bb;
|
||||
aa = a[0].toLowerCase();
|
||||
bb = b[0].toLowerCase();
|
||||
if (aa === bb) {
|
||||
return 0;
|
||||
}
|
||||
if (aa < bb) {
|
||||
return -1;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
setTimeout(sortable.init, 0);
|
||||
|
||||
window.Sortable = sortable;
|
||||
|
||||
}).call(this);
|
2
privacytools.io/assets/js/sortable.min.js
vendored
Normal file
2
privacytools.io/assets/js/sortable.min.js
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
/*! sortable.js 0.5.0 */
|
||||
(function(){var a,b,c,d,e,f;a="table[data-sortable]",c=/^-?[£$¤]?[\d,.]+%?$/,f=/^\s+|\s+$/g,e="ontouchstart"in document.documentElement,b=e?"touchstart":"click",d={init:function(){var b,c,e,f,g;for(c=document.querySelectorAll(a),g=[],e=0,f=c.length;f>e;e++)b=c[e],g.push(d.initTable(b));return g},initTable:function(a){var b,c,e,f,g;if(1===a.tHead.rows.length&&"true"!==a.getAttribute("data-sortable-initialized")){for(a.setAttribute("data-sortable-initialized","true"),e=a.querySelectorAll("th"),b=f=0,g=e.length;g>f;b=++f)c=e[b],"false"!==c.getAttribute("data-sortable")&&d.setupClickableTH(a,c,b);return a}},setupClickableTH:function(a,c,e){var f;return f=d.getColumnType(a,e),c.addEventListener(b,function(){var b,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u;for(j="true"===this.getAttribute("data-sorted"),k=this.getAttribute("data-sorted-direction"),b=j?"ascending"===k?"descending":"ascending":f.defaultSortDirection,m=this.parentNode.querySelectorAll("th"),n=0,q=m.length;q>n;n++)c=m[n],c.setAttribute("data-sorted","false"),c.removeAttribute("data-sorted-direction");for(this.setAttribute("data-sorted","true"),this.setAttribute("data-sorted-direction",b),l=a.tBodies[0],h=[],t=l.rows,o=0,r=t.length;r>o;o++)g=t[o],h.push([d.getNodeValue(g.cells[e]),g]);for(j?h.reverse():h.sort(f.compare),u=[],p=0,s=h.length;s>p;p++)i=h[p],u.push(l.appendChild(i[1]));return u})},getColumnType:function(a,b){var e,f,g,h,i;for(i=a.tBodies[0].rows,g=0,h=i.length;h>g;g++)if(e=i[g],f=d.getNodeValue(e.cells[b]),""!==f&&f.match(c))return d.types.numeric;return d.types.alpha},getNodeValue:function(a){return a?null!==a.getAttribute("data-value")?a.getAttribute("data-value"):"undefined"!=typeof a.innerText?a.innerText.replace(f,""):a.textContent.replace(f,""):""},types:{numeric:{defaultSortDirection:"descending",compare:function(a,b){var c,d;return c=parseFloat(a[0].replace(/[^0-9.-]/g,"")),d=parseFloat(b[0].replace(/[^0-9.-]/g,"")),isNaN(c)&&(c=0),isNaN(d)&&(d=0),d-c}},alpha:{defaultSortDirection:"ascending",compare:function(a,b){var c,d;return c=a[0].toLowerCase(),d=b[0].toLowerCase(),c===d?0:d>c?-1:1}}}},setTimeout(d.init,0),window.Sortable=d}).call(this);
|
Reference in New Issue
Block a user