diff --git a/.gitignore b/.gitignore index c3caece..8da9a7d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,4 @@ node_modules/ externs/ +bin/ +*.zip diff --git a/.haxerc b/.haxerc new file mode 100644 index 0000000..dc3cec2 --- /dev/null +++ b/.haxerc @@ -0,0 +1,4 @@ +{ + "version": "4.3.1", + "resolveLibs": "scoped" +} \ No newline at end of file diff --git a/build.hxml b/build.hxml index 10eac0b..45f94c6 100644 --- a/build.hxml +++ b/build.hxml @@ -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 \ No newline at end of file +-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 \ No newline at end of file diff --git a/haxe_libraries/haxe-strings.hxml b/haxe_libraries/haxe-strings.hxml index e5c6cbd..59cd626 100644 --- a/haxe_libraries/haxe-strings.hxml +++ b/haxe_libraries/haxe-strings.hxml @@ -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() diff --git a/haxe_libraries/kiss.hxml b/haxe_libraries/kiss.hxml index a05db95..bb6ec3d 100644 --- a/haxe_libraries/kiss.hxml +++ b/haxe_libraries/kiss.hxml @@ -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() \ No newline at end of file diff --git a/manifest.json b/manifest.json index 27e04cb..3582ec0 100644 --- a/manifest.json +++ b/manifest.json @@ -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": { diff --git a/src/pixabay_sourcer/Background.hx b/src/hollywoo_sourcer/Background.hx similarity index 79% rename from src/pixabay_sourcer/Background.hx rename to src/hollywoo_sourcer/Background.hx index 9d3d660..9e1ee77 100644 --- a/src/pixabay_sourcer/Background.hx +++ b/src/hollywoo_sourcer/Background.hx @@ -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; diff --git a/src/pixabay_sourcer/Background.kiss b/src/hollywoo_sourcer/Background.kiss similarity index 95% rename from src/pixabay_sourcer/Background.kiss rename to src/hollywoo_sourcer/Background.kiss index fa8ea01..67458e2 100644 --- a/src/pixabay_sourcer/Background.kiss +++ b/src/hollywoo_sourcer/Background.kiss @@ -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))] diff --git a/src/pixabay_sourcer/Message.hx b/src/hollywoo_sourcer/Message.hx similarity index 68% rename from src/pixabay_sourcer/Message.hx rename to src/hollywoo_sourcer/Message.hx index 09559db..27db6a9 100644 --- a/src/pixabay_sourcer/Message.hx +++ b/src/hollywoo_sourcer/Message.hx @@ -1,4 +1,4 @@ -package pixabay_sourcer; +package hollywoo_sourcer; typedef Message = { type:String, diff --git a/src/hollywoo_sourcer/PixabayMain.hx b/src/hollywoo_sourcer/PixabayMain.hx new file mode 100644 index 0000000..92a142f --- /dev/null +++ b/src/hollywoo_sourcer/PixabayMain.hx @@ -0,0 +1,7 @@ +package hollywoo_sourcer; + +class PixabayMain { + static function main() { + PixabayMain_.main(); + } +} diff --git a/src/pixabay_sourcer/Main_.kiss b/src/hollywoo_sourcer/PixabayMain_.kiss similarity index 93% rename from src/pixabay_sourcer/Main_.kiss rename to src/hollywoo_sourcer/PixabayMain_.kiss index d4442a3..c902d8d 100644 --- a/src/pixabay_sourcer/Main_.kiss +++ b/src/hollywoo_sourcer/PixabayMain_.kiss @@ -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" diff --git a/src/pixabay_sourcer/Main.hx b/src/pixabay_sourcer/Main.hx deleted file mode 100644 index 0831944..0000000 --- a/src/pixabay_sourcer/Main.hx +++ /dev/null @@ -1,7 +0,0 @@ -package pixabay_sourcer; - -class Main { - static function main() { - Main_.main(); - } -}