Mercurial > tinyurl_creator
diff chrome/content/done.xul @ 0:c14d52a3b2fe
initial import
author | Yoshiki Yazawa <yaz@honeyplanet.jp> |
---|---|
date | Mon, 11 Aug 2008 20:34:21 +0900 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/chrome/content/done.xul Mon Aug 11 20:34:21 2008 +0900 @@ -0,0 +1,68 @@ +<?xml version="1.0"?> + +<?xml-stylesheet href="chrome://communicator/skin/" type="text/css"?> + +<dialog buttons="accept" id="tinyurl-done-window" + title="TinyUrl Done" + onload="tinyurl_done_load();" + onblur="tinyurl_autohide()" + xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" + style="background: #FFC;"> + <script> + <![CDATA[ + var args = null; + + function tinyurl_done_load(){ + if(window.arguments.length > 0){ + args = new Array(); + args['tinyUrl'] = window.arguments[0]; + args['realUrl'] = window.arguments[1]; + args['title'] = (window.arguments.length > 2) ? window.arguments[2] : null; + + document.getElementById("tinyurl-label").appendChild(document.createTextNode(args['tinyUrl'])); + + window.focus(); + } + } + + function tinyurl_done_openSave(){ + if(opener != null && args != null){ + opener.tinyurl_saved_add(args['tinyUrl'], args['realUrl'], args['title']); + } + } + + function tinyurl_done_goto(){ + if(args['tinyUrl'] == null){ + alert("An error occurred"); + } + + if(opener){ + opener.gBrowser.selectedTab = opener.gBrowser.addTab(args['tinyUrl']); + } + else{ + window.open(args['tinyUrl']); + } + + self.close(); + } + + function tinyurl_autohide(){ + var oPrefs = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefService).getBranch(""); + + if(oPrefs.prefHasUserValue("tinyurl.confirmation.hide") && oPrefs.getBoolPref("tinyurl.confirmation.hide")) + setTimeout("self.close()", 100); + } + ]]> + </script> + <vbox style="font-weight: bold; padding: 10px text-align: center;" flex="1" align="center" pack="center"> + <description id="tinyurl-label"></description> + <description style="font-weight: normal;">has been copied to your clipboard.</description> + <spacer height="7" /> + <hbox> + <button label="Close" oncommand="self.close()" tabindex="0" dlgtype="accept" /> + <button label="Goto" oncommand="tinyurl_done_goto();" tabindex="1" style="font-size: x-small; font-weight: normal;" /> + <button label="Save" tabindex="2" oncommand="tinyurl_done_openSave()" style="font-size: x-small; font-weight: normal;" /> + </hbox> + <spacer height="7" /> + </vbox> +</dialog> \ No newline at end of file