aboutsummaryrefslogtreecommitdiff
path: root/user/plugins/sample-toolbar/js/toolbar.js
diff options
context:
space:
mode:
authors1n <[email protected]>2020-03-28 10:36:41 -0700
committers1n <[email protected]>2020-03-28 10:36:41 -0700
commit25b7d2aab61ae6421398d3abae5da6ffe590333d (patch)
tree611985ec78bb2d94099c9fd5dd687f5c9cee6f3e /user/plugins/sample-toolbar/js/toolbar.js
parentInitial commit (diff)
downloadcrack.cf-backup-master.tar.xz
crack.cf-backup-master.zip
3/28/2020, 10:36HEADmaster
Diffstat (limited to 'user/plugins/sample-toolbar/js/toolbar.js')
-rw-r--r--user/plugins/sample-toolbar/js/toolbar.js22
1 files changed, 22 insertions, 0 deletions
diff --git a/user/plugins/sample-toolbar/js/toolbar.js b/user/plugins/sample-toolbar/js/toolbar.js
new file mode 100644
index 0000000..bfa249a
--- /dev/null
+++ b/user/plugins/sample-toolbar/js/toolbar.js
@@ -0,0 +1,22 @@
+
+// If javascript is enabled, display the button
+document.getElementById('yourls-always').style.display = 'block';
+
+// When button clicked, store a cookie that says the user doesn't want a toolbar
+document.getElementById('yourls-always').onclick = yourls_cookie_no_toolbar_please;
+function yourls_cookie_no_toolbar_please() {
+ var exdate=new Date();
+ exdate.setDate( exdate.getDate()+365 ); // store 365 days
+ document.cookie = "yourls_no_toolbar=1;expires="+exdate.toUTCString() ;
+}
+
+// Get the number of delicious bookmarks
+function yourls_get_books(json) {
+ if( json.length ) {
+ var books = json[0].total_posts.toString();
+ if( books ) {
+ document.getElementById('yourls-delicious-link').innerHTML = ' <b>'+books+'</b> bookmarks';
+ }
+ }
+}
+