]> CyberLeo.Net >> Repos - Github/YOURLS.git/blob - user/plugins/sample-toolbar/js/toolbar.js
"Social Toolbar" improvements with delicious button and meta tags (charset, robots)
[Github/YOURLS.git] / user / plugins / sample-toolbar / js / toolbar.js
1 \r
2 // If javascript is enabled, display the button\r
3 document.getElementById('yourls-always').style.display = 'block';\r
4 \r
5 // When button clicked, store a cookie that says the user doesn't want a toolbar\r
6 document.getElementById('yourls-always').onclick = yourls_cookie_no_toolbar_please;\r
7 function yourls_cookie_no_toolbar_please() {\r
8         var exdate=new Date();\r
9         exdate.setDate( exdate.getDate()+365 ); // store 365 days\r
10         document.cookie = "yourls_no_toolbar=1;expires="+exdate.toUTCString() ;\r
11 }\r
12 \r
13 // Get the number of delicious bookmarks\r
14 function yourls_get_books(json) {\r
15         if( json.length ) {\r
16                 var books = json[0].total_posts.toString();\r
17                 if( books ) {\r
18                         document.getElementById('yourls-delicious-link').innerHTML  = ' <b>'+books+'</b> bookmarks';\r
19                 }\r
20         }\r
21 }\r
22 \r