Created
March 20, 2010 08:50
-
-
Save CQD/338561 to your computer and use it in GitHub Desktop.
為 Firefox 增加振奮精神功能的 Jetpack
This file contains 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
var currDoc = jetpack.tabs.focused.contentDocument; | |
var th; // Timer hanlder, used for clear timeout timer | |
/*啟動時,顯示訊息,兩秒後隱藏訊息*/ | |
getUp = function(){ | |
hideGetUpBox(); | |
currDoc = jetpack.tabs.focused.contentDocument; | |
showGetUpBox(); | |
th = setTimeout(hideGetUpBox,2000); | |
} | |
/*顯示讓人振奮精神的台詞*/ | |
function showGetUpBox(){ | |
clearTimeout(th); | |
$('body',currDoc).append( "<div id='getupbox' style='position:fixed; z-index:100000; top:0; left:0; width:100%; text-align:center; height:100%; background-color:black; color:white; font-size:50px;'><br><br>醒來!!現在也才~三點~</div>" ); | |
} | |
/*隱藏讓人振奮精神的台詞*/ | |
function hideGetUpBox(){ | |
$('#getupbox',currDoc).remove(); | |
} | |
/*在右鍵選單增加讓人振奮精神的選項*/ | |
jetpack.future.import("menu"); | |
jetpack.menu.context.page.add({label: "振奮精神", command: getUp}); | |
/*在工具列增加讓人振奮精神的按鈕*/ | |
jetpack.future.import("toolbar"); | |
var myButton = {id: "getUp",label: "振奮精神",tooltip: "讓人振奮精神的按鈕",image: "http://www.mozilla.org/favicon.ico",onclick: function(event) { getUp(); }} | |
jetpack.toolbar.navigation.append(myButton); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment