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