// @name SlimTimer With Notifications - meon // @desc Quick and simple SlimTimer Bubble with notifications-popups. // @url http://slimtimer.com/client new function() { // context-menu itemss SSB.contextMenu.add('SlimTimer', 'http://www.slimtimer.com/client'); SSB.contextMenu.add('Reports', 'http://www.slimtimer.com/report'); SSB.contextMenu.add('Tasks', 'http://www.slimtimer.com/task'); SSB.contextMenu.add('Profile', 'http://www.slimtimer.com/user/profile'); SSB.contextMenu.add('Help', 'http://www.slimtimer.com/help'); var win = window.top; addNotifOptions(); checkTitleChange(); function checkTitleChange() { var refreshTimeMS = document.getElementById('notiftime').value*60*1000; win.setTimeout(checkTitleChange, refreshTimeMS); var title = win.document.title; if (title != "Stopped" && document.getElementById('notifcheck').checked) { var html = getStringFromFunction(notificationHTML); title = title.split("|"); html = html.replace(/__TIMER__/, title[1]); html = html.replace(/__TASK__/, title[2]); SSB.notify(html, 295, 117, 10); } } } function addNotifOptions() { var timer = document.getElementById('client'); var newdiv = document.createElement('div'); newdiv.setAttribute('id','notif'); newdiv.innerHTML = "
Notifications:
"; timer.appendChild(newdiv); document.getElementById('notif').style.position = "fixed"; document.getElementById('notif').style.background = "#FFF2F2"; document.getElementById('notif').style.bottom = "0"; document.getElementById('notif').style.height = "30px"; document.getElementById('notif').style.width = "100%"; document.getElementById('notif').style.padding = "3px"; } /* * Gets function reference and returns string of first matched text between commented * block just like this one. */ function getStringFromFunction(fnc) { var string = fnc.toString(); return string.match(/\/\*([\s\S]*)\*\//)[1]; } function notificationHTML() {/*