Created
July 4, 2012 12:25
-
-
Save karlcow/3047063 to your computer and use it in GitHub Desktop.
DNT status
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Script in http://donottrack.us/js/index.js | |
var aboutexpanded = false; | |
var developerexpanded = false; | |
var policyexpanded = false; | |
$(document).ready(function() { | |
// Show browser support region | |
$('#browser_support').show(); | |
// Set DNT status | |
if(typeof dnt == 'boolean') | |
setDNTStatus(dnt); | |
else | |
setDNTStatus(false); | |
// Set DNT capability | |
if(BrowserDetect.browser == "Explorer" && BrowserDetect.version >= 9) { | |
setDNTCapable(true); | |
setBold('#browser_ie'); | |
} | |
else if(BrowserDetect.browser == "Firefox" && BrowserDetect.version >= 4) { | |
setDNTCapable(true); | |
setBold('#browser_firefox'); | |
} | |
else if(BrowserDetect.browser == "Safari" && BrowserDetect.version >= 5.1) { | |
setDNTCapable(true); | |
setBold('#browser_safari'); | |
} | |
else | |
setDNTCapable(false); | |
// show random tip | |
currenttip = null; // global | |
showRandomTip(); | |
}); | |
function showRandomTip() { | |
tips=$('.dyktip'); | |
tips.hide(); | |
while (1){ | |
var newtip = tips[Math.floor (Math.random() * tips.length)]; | |
if (newtip != currenttip) | |
break; | |
} | |
newtip.style.display='inline'; | |
currenttip = newtip; | |
} | |
function setBold(id) { | |
$(id).html('<b>' + $(id).html() + '</b>'); | |
} | |
function setDNTStatus(dnt) | |
{ | |
if(dnt) | |
{ | |
$('#dnt_status').text('have enabled '); | |
$('#dnt_status_indicator').html('<span style="color: #00D000"> ✓ </span>'); | |
} | |
else | |
{ | |
$('#dnt_status').text('have not enabled '); | |
$('#dnt_status_indicator').html('<span style="color: #F00000">x</span>'); | |
} | |
} | |
function setDNTCapable(dnt_capable) | |
{ | |
if(dnt_capable) | |
{ | |
$('#dnt_capability').text('supports '); | |
$('#dnt_capability_indicator').html('<span style="color: #00D000"> ✓ </span>'); | |
} | |
else | |
{ | |
$('#dnt_capability').text('does not support '); | |
$('#dnt_capability_indicator').html('<span style="color: #F00000">x</span>'); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment