# HG changeset patch # User Yoshiki Yazawa # Date 1218454461 -32400 # Node ID c14d52a3b2fe7505742412e6a6b53425e4cb6b37 initial import diff -r 000000000000 -r c14d52a3b2fe Makefile --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Makefile Mon Aug 11 20:34:21 2008 +0900 @@ -0,0 +1,14 @@ +app=tinyurl +vers=_2_0_0 + +all: + cd chrome; zip -r $(app).jar content + zip -r $(app)$(vers).xpi chrome/$(app).jar install.rdf + +clean: + rm -f $(app)$(vers).xpi + rm -f chrome/$(app).jar + +mostlyclean: clean + find . -name "*~" -exec rm {} ';' + find . -name "#*#" -exec rm {} ';' diff -r 000000000000 -r c14d52a3b2fe chrome/content/contents.rdf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/chrome/content/contents.rdf Mon Aug 11 20:34:21 2008 +0900 @@ -0,0 +1,45 @@ + + + + + + + + + + + + UChrm:tinyurl.rdf + + + + + + + + + + + + + chrome://tinyurl/content/tinyurl_overlay.xul + + + chrome://tinyurl/content/tinyurl_overlay.xul + + + + + chrome://tinyurl/content/tinyurl_overlay.xul + + + + diff -r 000000000000 -r c14d52a3b2fe chrome/content/contents.rdf.in --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/chrome/content/contents.rdf.in Mon Aug 11 20:34:21 2008 +0900 @@ -0,0 +1,45 @@ + + + + + + + + + + + + UChrm:tinyurl.rdf + + + + + + + + + + + + + chrome://tinyurl/content/tinyurl_overlay.xul + + + chrome://tinyurl/content/tinyurl_overlay.xul + + + + + chrome://tinyurl/content/tinyurl_overlay.xul + + + + \ No newline at end of file diff -r 000000000000 -r c14d52a3b2fe chrome/content/create.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/chrome/content/create.js Mon Aug 11 20:34:21 2008 +0900 @@ -0,0 +1,89 @@ +var tiny = null; + +/** +* Create a TinyUrl from the current url +*/ +function tinyurl_create_load(){ + window.removeEventListener("load", tinyurl_create_load, true); + + if(window.arguments.length > 0 && tiny == null){ + tiny = window.arguments[0]; + + document.getElementById("cancel-btn").focus(); + + var loaded = { + done : function(oTiny){ + try{ + // Set values + document.getElementById("tinyurl-label").appendChild(document.createTextNode(oTiny.tiny)); + document.getElementById("loading-steps").selectedIndex = 1; + document.getElementById("cancel-btn").setAttribute("default", false); + document.getElementById("close1-btn").setAttribute("default", true); + document.getElementById("close1-btn").focus(); + + // Copy text + var clipboard = Components.classes["@mozilla.org/widget/clipboardhelper;1"].getService(Components.interfaces.nsIClipboardHelper); + clipboard.copyString(oTiny.tiny); + + // Auto-hide the window + 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")){ + self.close(); + } + else{ + window.focus(); + } + }catch(e){ } + }, + + error : function(oTiny){ + document.getElementById("loading-steps").selectedIndex = 2; + document.getElementById("close2-btn").setAttribute("default", true); + document.getElementById("close2-btn").focus(); + } + } + + tiny.shrink(loaded); + } +} + +/** +* Cancel url shrinking +*/ +function tinyrl_create_cancel(){ + try{ + tiny.abort(); + }catch(e){ } + self.close(); +} + +/** +* Open save dialog +*/ +function tinyurl_create_openSave(){ + try{ + if(tinyurl_saved_add(tiny.tiny, tiny.original, tiny.title) == true){ + self.close(); + } + }catch(e){ + alert(e); + } +} + +/** +* Goto the url +*/ +function tinyurl_create_goto(){ + if(tiny.tiny == null){ + alert("An error occurred"); + } + + if(opener){ + opener.gBrowser.selectedTab = opener.gBrowser.addTab(tiny.tiny); + } + else{ + window.open(tiny.tiny); + } + + self.close(); +} \ No newline at end of file diff -r 000000000000 -r c14d52a3b2fe chrome/content/create.xul --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/chrome/content/create.xul Mon Aug 11 20:34:21 2008 +0900 @@ -0,0 +1,46 @@ + + + + + + + + + + + + + + + + + + +