restructure for multiple supported source sites
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -1,2 +1,4 @@
|
||||
node_modules/
|
||||
externs/
|
||||
bin/
|
||||
*.zip
|
||||
|
@@ -4,9 +4,9 @@
|
||||
-cp src
|
||||
-dce full
|
||||
--each
|
||||
--main pixabay_sourcer.Main
|
||||
--js bin/main.js
|
||||
--main hollywoo_sourcer.PixabayMain
|
||||
--js bin/pixabay.js
|
||||
--next
|
||||
--main pixabay_sourcer.Background
|
||||
--main hollywoo_sourcer.Background
|
||||
--js bin/background.js
|
||||
-cmd cp node_modules/webextension-polyfill/dist/browser-polyfill.js* bin/ && zip -r template.zip . -x *.git* -x *.hxml -x *.zip -x src/\* -x node_modules/\* -x libs/\* -x test.sh
|
||||
-cmd cp node_modules/webextension-polyfill/dist/browser-polyfill.js* bin/ && zip -r hollywoo-sourcer.zip . -x *.git* -x *.hxml -x *.zip -x src/\* -x node_modules/\* -x libs/\* -x test.sh
|
@@ -1,5 +1,5 @@
|
||||
# @install: lix --silent download "haxelib:/haxe-strings#7.0.2" into haxe-strings/7.0.2/haxelib
|
||||
-cp ${HAXE_LIBCACHE}/haxe-strings/7.0.2/haxelib/src/
|
||||
-D haxe-strings=7.0.2
|
||||
# @install: lix --silent download "haxelib:/haxe-strings#7.0.3" into haxe-strings/7.0.3/haxelib
|
||||
-cp ${HAXE_LIBCACHE}/haxe-strings/7.0.3/haxelib/src/
|
||||
-D haxe-strings=7.0.3
|
||||
--macro hx.strings.internal.Macros.addDefines()
|
||||
--macro hx.strings.internal.Macros.configureNullSafety()
|
||||
|
@@ -1,12 +1,12 @@
|
||||
# @install: lix --silent download "gh://github.com/kiss-lang/kiss#a6c0cf88c6a02aa7845dca7c5c5025b915b78fbc" into kiss/0.0.1/github/a6c0cf88c6a02aa7845dca7c5c5025b915b78fbc
|
||||
# @run: haxelib run-dir kiss "${HAXE_LIBCACHE}/kiss/0.0.1/github/a6c0cf88c6a02aa7845dca7c5c5025b915b78fbc"
|
||||
# @install: lix --silent download "gh://github.com/kiss-lang/kiss#d46e386972dd893a690fd20427613bd9dca5a60d" into kiss/0.0.1/github/d46e386972dd893a690fd20427613bd9dca5a60d
|
||||
# @run: haxelib run-dir kiss "${HAXE_LIBCACHE}/kiss/0.0.1/github/d46e386972dd893a690fd20427613bd9dca5a60d"
|
||||
-lib haxe-strings
|
||||
-lib hscript
|
||||
-lib tink_json
|
||||
-lib tink_macro
|
||||
-lib tink_syntaxhub
|
||||
-lib uuid
|
||||
-cp ${HAXE_LIBCACHE}/kiss/0.0.1/github/a6c0cf88c6a02aa7845dca7c5c5025b915b78fbc/src/
|
||||
-cp ${HAXE_LIBCACHE}/kiss/0.0.1/github/d46e386972dd893a690fd20427613bd9dca5a60d/src
|
||||
-D kiss=0.0.1
|
||||
-w -WUnusedPattern
|
||||
--macro kiss.KissFrontend.use()
|
@@ -1,7 +1,7 @@
|
||||
{
|
||||
|
||||
"manifest_version": 2,
|
||||
"name": "pixabay-sourcer",
|
||||
"name": "hollywoo-sourcer",
|
||||
"version": "0.0",
|
||||
|
||||
"description": "",
|
||||
@@ -11,8 +11,8 @@
|
||||
},
|
||||
"content_scripts": [
|
||||
{
|
||||
"matches": ["https://pixabay.com/photos/*/"],
|
||||
"js": ["bin/browser-polyfill.js", "bin/main.js"]
|
||||
"matches": ["https://pixabay.com/*/*/"],
|
||||
"js": ["bin/browser-polyfill.js", "bin/pixabay.js"]
|
||||
}
|
||||
],
|
||||
"background": {
|
||||
|
@@ -1,9 +1,9 @@
|
||||
package pixabay_sourcer;
|
||||
package hollywoo_sourcer;
|
||||
|
||||
import kiss.Prelude;
|
||||
import kiss_firefox.API;
|
||||
import haxe.Constraints;
|
||||
import pixabay_sourcer.Message;
|
||||
import hollywoo_sourcer.Message;
|
||||
import haxe.io.Path;
|
||||
import js.html.File;
|
||||
import js.html.URL;
|
@@ -2,7 +2,7 @@
|
||||
(API.browser.runtime.onMessage.addListener ->[:Message message sender sendResponse]
|
||||
(let [:Function sendResponse sendResponse]
|
||||
(case message
|
||||
((object type "download" data [imageInfo])
|
||||
((object type "downloadPixabay" data [imageInfo])
|
||||
// awaitLet the DownloadItem and make an object url with the source info
|
||||
(awaitLet [dlItemId (API.browser.downloads.download (object saveAs true url imageInfo.largeImageURL))
|
||||
dlItems (API.browser.downloads.search (object id dlItemId))]
|
@@ -1,4 +1,4 @@
|
||||
package pixabay_sourcer;
|
||||
package hollywoo_sourcer;
|
||||
|
||||
typedef Message = {
|
||||
type:String,
|
7
src/hollywoo_sourcer/PixabayMain.hx
Normal file
7
src/hollywoo_sourcer/PixabayMain.hx
Normal file
@@ -0,0 +1,7 @@
|
||||
package hollywoo_sourcer;
|
||||
|
||||
class PixabayMain {
|
||||
static function main() {
|
||||
PixabayMain_.main();
|
||||
}
|
||||
}
|
@@ -1,7 +1,7 @@
|
||||
(import kiss_firefox.API)
|
||||
(import js.lib.Promise)
|
||||
(importAs js.html.XMLHttpRequest XHR)
|
||||
(import pixabay_sourcer.Message)
|
||||
(import hollywoo_sourcer.Message)
|
||||
(var :Dynamic document js.Lib.global.document)
|
||||
(var :Dynamic window js.Lib.global.window)
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
(request.send)))
|
||||
|
||||
(function handleInfo [:Dynamic info]
|
||||
(awaitLet [response (API.browser.runtime.sendMessage (object type "download" data [(first info.hits)]))]
|
||||
(awaitLet [response (API.browser.runtime.sendMessage (object type "downloadPixabay" data [(first info.hits)]))]
|
||||
(print response)))
|
||||
|
||||
(window.addEventListener "load"
|
@@ -1,7 +0,0 @@
|
||||
package pixabay_sourcer;
|
||||
|
||||
class Main {
|
||||
static function main() {
|
||||
Main_.main();
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user