forked from RookieonIHG/ImageHost-Grabber
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a2c6756
commit f62483f
Showing
106 changed files
with
15,486 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
content imagegrabber chrome/content/ | ||
skin imagegrabber default chrome/skin/ | ||
|
||
locale imagegrabber en-US chrome/locale/en-US/ | ||
locale imagegrabber de-DE chrome/locale/de-DE/ | ||
locale imagegrabber es-ES chrome/locale/es-ES/ | ||
locale imagegrabber tr-TR chrome/locale/tr-TR/ | ||
locale imagegrabber fr-FR chrome/locale/fr-FR/ | ||
|
||
# Firefox windows | ||
overlay chrome://browser/content/browser.xul chrome://imagegrabber/content/overlay.xul application={ec8030f7-c20a-464f-9b0e-13a3a9e97384} | ||
# Pale Moon windows | ||
overlay chrome://browser/content/browser.xul chrome://imagegrabber/content/overlay.xul application={8de7fcbb-c55c-4fbe-bfc5-fc555c87dbc4} | ||
|
||
style chrome://browser/content/browser.xul chrome://imagegrabber/skin/overlay.css | ||
style chrome://global/content/customizeToolbar.xul chrome://imagegrabber/skin/overlay.css |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,153 @@ | ||
/****************************** Start of GPL Block **************************** | ||
* ImageHost Grabber - Imagegrabber is a firefox extension designed to | ||
* download pictures from image hosts such as imagevenue, imagebeaver, and | ||
* others (see help file for a full list of supported hosts). | ||
* | ||
* Copyright (C) 2007 Matthew McMullen. | ||
* | ||
* This program is free software; you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation; either version 2 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program; if not, write to the Free Software | ||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
* | ||
*************************** End of GPL Block *******************************/ | ||
|
||
ihg_Functions.escape_everything = function escape_everything(sometext) { | ||
var tmp_string = escape(sometext); | ||
tmp_string = tmp_string.replace(/\*/g, "%2A"); | ||
tmp_string = tmp_string.replace(/@/g, "%40"); | ||
//tmp_string = tmp_string.replace(/-/g, "%2D"); | ||
tmp_string = tmp_string.replace(/_/g, "%5F"); | ||
tmp_string = tmp_string.replace(/\+/g, "%2B"); | ||
tmp_string = tmp_string.replace(/\./g, "%2E"); | ||
tmp_string = tmp_string.replace(/\//g, "%2F"); | ||
|
||
return tmp_string; | ||
} | ||
|
||
ihg_Functions.get_cookies = function get_cookies() { | ||
var cookieManager = Components.classes["@mozilla.org/cookiemanager;1"].getService(Components.interfaces.nsICookieManager); | ||
var enumeratorThing = cookieManager.enumerator; | ||
|
||
var cookieTree = new Array(); | ||
|
||
var count = 0; | ||
while(enumeratorThing.hasMoreElements()) { | ||
var newCookie = enumeratorThing.getNext().QueryInterface(Components.interfaces.nsICookie); | ||
if (newCookie.host.match(/^\.myspace/)) { | ||
cookieTree[count] = newCookie; | ||
count++; | ||
} | ||
} | ||
|
||
var CookieString = ""; | ||
|
||
for (var i = 0; i < cookieTree.length; i++) { | ||
if (cookieTree[i].host.match(/^\.myspace/)) { | ||
CookieString += cookieTree[i].name + "=" + cookieTree[i].value + (i==cookieTree.length-1?"":"; "); | ||
} | ||
} | ||
return CookieString; | ||
} | ||
|
||
ihg_Functions.getMyspacePage = function getMyspacePage(pageURL, newEventTarget, newEventArgument) { | ||
if (!newEventTarget) var newEventTarget = 'ctl00$Main$PagerTop'; | ||
var ref_url = pageURL; | ||
|
||
|
||
var ios = Components.classes["@mozilla.org/network/io-service;1"].getService(Components.interfaces.nsIIOService); | ||
var sis = Components.classes["@mozilla.org/scriptableinputstream;1"].createInstance(Components.interfaces.nsIScriptableInputStream); | ||
var transportService = Components.classes["@mozilla.org/network/socket-transport-service;1"].getService(Components.interfaces.nsISocketTransportService); | ||
var pump = Components.classes["@mozilla.org/network/input-stream-pump;1"].createInstance(Components.interfaces.nsIInputStreamPump); | ||
|
||
|
||
req = new XMLHttpRequest(); | ||
req.open("GET", ref_url, false); | ||
req.send(null); | ||
|
||
|
||
CookieString = get_cookies(); | ||
|
||
|
||
var theForm = req.responseText.match(/<form.+?id=("|')aspnetForm\1.*?>(?:.|[\f\n\r])+?<\/form>/)[0]; | ||
var inputs = theForm.match(/<input.*>/g); | ||
|
||
var postData = ""; | ||
|
||
for(var i = 0; i < inputs.length; i++) { | ||
var id = inputs[i].match(/id=("|')(.*?)\1/)[2]; | ||
|
||
if(id.match(/EVENTTARGET/)) var value = newEventTarget; | ||
else if(id.match(/EVENTARGUMENT/)) var value = newEventArgument; | ||
else var value = inputs[i].match(/value=("|')(.*?)\1/)[2]; | ||
|
||
if(id.match(/^ctl00/)) id = id.replace(/_/g, '%24'); | ||
|
||
value = ihg_Functions.escape_everything(value); | ||
postData += id + "=" + value + (i==inputs.length-1?"":"&"); | ||
} | ||
|
||
var ref_uri = ios.newURI(ref_url, null, null); | ||
ref_uri = ref_uri.QueryInterface(Components.interfaces.nsIURL); | ||
var cont_len = postData.length; | ||
var host = ref_uri.host; | ||
var file_and_args = ref_uri.path; | ||
|
||
var temp_thing = "POST " + file_and_args + " HTTP/1.1\r\n"; | ||
temp_thing += "Accept-Encoding: gzip, deflate\r\n"; | ||
temp_thing += "Host: " + host + "\r\n"; | ||
temp_thing += "User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.6) Gecko/20070725 Firefox/2.0.0.6 XPCOMViewer/0.9.5\r\n"; | ||
temp_thing += "Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5\r\n"; | ||
temp_thing += "Accept-Language: en-us,en;q=0.5\r\n"; | ||
temp_thing += "---------------: ------------\r\n"; | ||
temp_thing += "Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7\r\n"; | ||
//temp_thing += "Keep-Alive: 300\r\n"; | ||
temp_thing += "Connection: close\r\n"; | ||
temp_thing += "Referer: " + ref_url + "\r\n"; | ||
temp_thing += "Cookie: " + CookieString + "\r\n"; | ||
temp_thing += "Content-Type: application/x-www-form-urlencoded\r\n"; | ||
temp_thing += "Content-Length: " + cont_len + "\r\n\r\n"; | ||
temp_thing += postData + "\r\n"; | ||
|
||
|
||
var transport = transportService.createTransport(null,0,host,80,null); | ||
var outstream = transport.openOutputStream(0,0,0); | ||
outstream.write(temp_thing,temp_thing.length); | ||
|
||
var instream = transport.openInputStream(0,0,0); | ||
sis.init(instream); | ||
|
||
var dataListener = { | ||
responseText : "", | ||
onStartRequest : function() {}, | ||
onStopRequest : function() { | ||
instream.close(); | ||
outstream.close(); | ||
dump("We did it!\n"); | ||
var tmpObj = { | ||
target : { | ||
channel : { name : threadURL + "&page=" + newEventArgument }, | ||
responseText : this.responseText | ||
} | ||
} | ||
getRDun(tmpObj); | ||
}, | ||
onDataAvailable : function(request, context, inputStream, offset, count) { | ||
var poop = sis.read(count); | ||
this.responseText += poop; | ||
dump("count: " + count + "\n"); | ||
dump("isPending: " + request.isPending() + "\n"); | ||
} | ||
} | ||
pump.init(instream, -1, -1, 0, 0, false); | ||
pump.asyncRead(dataListener, null); | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
ihg_Functions.getTumblrPage = function getTumblrPage(pageURL, filterImages, time, targetLinks) { | ||
var d = time || Math.round(new Date().getTime() / 1000.0); | ||
var allLinks = targetLinks || []; | ||
|
||
var url = pageURL.match(/^.+\/archive/)[0] + "?before_time=" + d; | ||
|
||
var req = new XMLHttpRequest(); | ||
req.open("GET", url, true); | ||
|
||
try { | ||
req.channel.QueryInterface(Components.interfaces.nsIHttpChannelInternal).forceAllowThirdPartyCookie = true; | ||
} | ||
catch(e) { /* Requires Gecko 1.9.2 */ } | ||
|
||
req.setRequestHeader("Referer", pageURL.match(/^.+\/archive/)[0]); | ||
req.setRequestHeader("X-Requested-With", "XMLHttpRequest"); | ||
|
||
req.onload = function () { | ||
if (req.status !== 200) { | ||
alert("Error processing this tumblr page. Please try again."); | ||
return; | ||
} | ||
|
||
var pageData = req.responseText; | ||
var tempLinks = ihg_Functions.getLinks(pageData); | ||
|
||
for (var i = 0; i < tempLinks.length; i++) { | ||
// Possibly add some code here to handle other javascript type links | ||
var jsWrappedUrl = tempLinks[i].match(/javascript.+(\'|\")(https?.+?)\1/); | ||
if (jsWrappedUrl) tempLinks[i] = jsWrappedUrl[2]; | ||
|
||
var isEmbedded = false; | ||
if (tempLinks[i].match(/^\[embeddedImg\]/)) { | ||
isEmbedded = true; | ||
tempLinks[i] = tempLinks[i].replace(/^\[embeddedImg\]/, ""); | ||
} | ||
|
||
var someURI; | ||
try { | ||
someURI = ihg_Globals.ioService.newURI(tempLinks[i], null, null); | ||
} | ||
catch (e) { | ||
someURI = ihg_Globals.ioService.newURI(req.channel.originalURI.spec, null, null); | ||
tempLinks[i] = someURI.resolve(tempLinks[i]); | ||
} | ||
|
||
if (isEmbedded) tempLinks[i] = "[embeddedImg]" + tempLinks[i]; | ||
|
||
allLinks.push(tempLinks[i]); | ||
} | ||
|
||
var nextPage = pageData.match(/\?before_time=(\d+)/); | ||
if (nextPage) { | ||
ihg_Functions.getTumblrPage(req.channel.originalURI.spec, filterImages, nextPage[1], allLinks); | ||
} | ||
else { | ||
var docLinks = []; | ||
docLinks[ihg_Globals.firstPage] = allLinks; | ||
ihg_Functions.hostGrabber(docLinks, filterImages); | ||
} | ||
}; | ||
req.onerror = function () { | ||
alert("Error processing this tumblr page. Please try again."); | ||
}; | ||
|
||
req.send(null); | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
<?xml version="1.0"?> | ||
<!DOCTYPE bindings SYSTEM "chrome://imagegrabber/locale/overlay.dtd"> | ||
|
||
<bindings xmlns="http://www.mozilla.org/xbl" xmlns:xbl="http://www.mozilla.org/xbl" xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> | ||
<binding id="ihgMenuItems" extends="xul:menupopup"> | ||
<resources> | ||
<stylesheet src="chrome://global/skin/popup.css"/> | ||
</resources> | ||
|
||
<content> | ||
<!-- <xul:arrowscrollbox class="popup-internal-box" flex="1" orient="vertical" smoothscroll="false"> --> | ||
<xul:menuitem label="&get_all_pics_page.label;" accesskey="&get_all_pics_page.accesskey;" oncommand="ihg_Functions.hostGrabber(null, false);" key="ihg-getAll_cmd"/> | ||
<xul:menuitem label="&get_selected_pics_page.label;" accesskey="&get_selected_pics_page.accesskey;" oncommand="ihg_Functions.hostGrabber(null, true);" key="ihg-getSelected_cmd"/> | ||
<xul:menuseparator/> | ||
<xul:menuitem anonid="suckthread" label="&suck_the_current_thread.label;" accesskey="&suck_the_current_thread.accesskey;" oncommand="ihg_Functions.leechThread();"/> | ||
<xul:menuseparator/> | ||
<xul:menuitem label="&host_file_editor.label;" accesskey="&host_file_editor.accesskey;" oncommand="openDialog('chrome://imagegrabber/content/interfaces/hostfile_ui.xul')"/> | ||
<xul:menuitem label="&blacklist_editor.label;" accesskey="&blacklist_editor.accesskey;" oncommand="ihg_Functions.showBlacklistDialog();"/> | ||
<xul:menuitem label="&show_dl_window.label;" accesskey="&show_dl_window.accesskey;" oncommand="ihg_Functions.showDLWin('dlwin_exit_state');"/> | ||
<xul:menuseparator/> | ||
<xul:menuitem label="&options.label;" accesskey="&options.accesskey;" oncommand="ihg_Functions.showPreferencesDialog();"/> | ||
<xul:menuitem label="&help.label;" accesskey="&help.accesskey;" oncommand="openDialog('chrome://imagegrabber/locale/help.html', '', 'dialog=no,close,resizable,scrollbars,minimizable,width=800,height=600')"/> | ||
<!-- </xul:arrowscrollbox> --> | ||
</content> | ||
|
||
<handlers> | ||
<handler event="popupshowing" phase="target"><![CDATA[ | ||
var suckMI = document.getAnonymousElementByAttribute(this, "anonid", "suckthread"); | ||
if (isThread(content.document.location.href) == true) { | ||
suckMI.setAttribute("disabled", false); | ||
suckMI.removeAttribute("tooltip"); | ||
} | ||
else { | ||
suckMI.setAttribute("disabled", true); | ||
suckMI.setAttribute("tooltip", "suck_the_current_thread-tip"); | ||
} | ||
]]> | ||
</handler> | ||
</handlers> | ||
</binding> | ||
|
||
<binding id="ihgLabelGroup"> | ||
<content> | ||
<xul:vbox> | ||
<xul:label class="header" xbl:inherits="disabled, xbl:text=buttonlabel"/> | ||
<xul:label class="indent" xbl:inherits="disabled, xbl:text=description"/> | ||
</xul:vbox> | ||
</content> | ||
|
||
<implementation> | ||
<property name="id" onget="return this.getAttribute('id');" onset="return this.setAttribute('id', val);"/> | ||
<property name="disabled" onget="return this.getAttribute('disabled');" onset="return this.setAttribute('disabled', val);"/> | ||
</implementation> | ||
</binding> | ||
|
||
<binding id="ihgToolTip" extends="chrome://global/content/bindings/popup.xml#tooltip"> | ||
<resources> | ||
<stylesheet src="chrome://global/skin/popup.css"/> | ||
</resources> | ||
|
||
<content> | ||
<children/> | ||
</content> | ||
|
||
<handlers> | ||
<handler event="popupshowing" phase="target"><![CDATA[ | ||
var suckTL = document.getElementById("suckCurThreadLabel"); | ||
if (isThread(content.document.location.href) == true) { | ||
suckTL.setAttribute("disabled", false); | ||
} | ||
else { | ||
suckTL.setAttribute("disabled", true); | ||
} | ||
]]> | ||
</handler> | ||
</handlers> | ||
</binding> | ||
</bindings> |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
/* | ||
* CCallWrapper.js | ||
* $Revision: 1.3 $ $Date: 2003/07/07 18:32:43 $ | ||
*/ | ||
|
||
/* ***** BEGIN LICENSE BLOCK ***** | ||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1 | ||
* | ||
* The contents of this file are subject to the Mozilla Public License Version | ||
* 1.1 (the "License"); you may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* http://www.mozilla.org/MPL/ | ||
* | ||
* Software distributed under the License is distributed on an "AS IS" basis, | ||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License | ||
* for the specific language governing rights and limitations under the | ||
* License. | ||
* | ||
* The Original Code is Netscape code. | ||
* | ||
* The Initial Developer of the Original Code is | ||
* Netscape Corporation. | ||
* Portions created by the Initial Developer are Copyright (C) 2003 | ||
* the Initial Developer. All Rights Reserved. | ||
* | ||
* Contributor(s): Bob Clary <[email protected]> | ||
* | ||
* ***** END LICENSE BLOCK ***** */ | ||
|
||
ihg_Functions.CCallWrapper = function CCallWrapper(aObjectReference, aDelay, aMethodName, aReqId) { | ||
this.mId = 'CCallWrapper_' + (ihg_Functions.CCallWrapper.mCounter++); | ||
ihg_Functions.LOG("Initializing new CCallWrapper object with mId of " + this.mId + " and reqID of " + aReqId + "\n"); | ||
this.mObjectReference = aObjectReference; | ||
this.mDelay = aDelay; | ||
this.mTimerId = 0; | ||
this.mMethodName = aMethodName; | ||
this.mReqId = aReqId; | ||
ihg_Functions.CCallWrapper.mPendingCalls[this.mId] = this; | ||
} | ||
|
||
ihg_Functions.CCallWrapper.prototype.execute = function() { | ||
ihg_Functions.LOG("CCallWrapper object with mId of " + this.mId + " and reqID of " + this.mReqId + " has timed out. Executing the passed function '" + this.mMethodName + "'\n"); | ||
this.mObjectReference[this.mMethodName](); | ||
delete ihg_Functions.CCallWrapper.mPendingCalls[this.mId]; | ||
}; | ||
|
||
ihg_Functions.CCallWrapper.prototype.cancel = function() { | ||
ihg_Functions.LOG("CCallWrapper object with mId of " + this.mId + " and reqID of " + this.mReqId + " cancelled.[" + this.mMethodName + "]\n"); | ||
clearTimeout(this.mTimerId); | ||
delete ihg_Functions.CCallWrapper.mPendingCalls[this.mId]; | ||
}; | ||
|
||
ihg_Functions.CCallWrapper.asyncExecute = function (/* CCallWrapper */ callwrapper) { | ||
ihg_Functions.LOG("asyncExecute called in CCallWrapper with mId of " + callwrapper.mId + " and reqID of " + callwrapper.mReqId + "\n"); | ||
ihg_Functions.CCallWrapper.mPendingCalls[callwrapper.mId].mTimerId = setTimeout(self => self.execute(), callwrapper.mDelay, ihg_Functions.CCallWrapper.mPendingCalls[callwrapper.mId]); | ||
}; | ||
|
||
ihg_Functions.CCallWrapper.mCounter = 0; | ||
ihg_Functions.CCallWrapper.mPendingCalls = {}; |
Oops, something went wrong.