move pixabay-sourcer to hollywoo-sourcer
This commit is contained in:
@@ -1,5 +0,0 @@
|
||||
bin/
|
||||
libs/
|
||||
node_modules/
|
||||
externs/
|
||||
*.zip
|
@@ -1,4 +0,0 @@
|
||||
{
|
||||
"version": "4.3.1",
|
||||
"resolveLibs": "scoped"
|
||||
}
|
@@ -1,12 +0,0 @@
|
||||
-lib kiss
|
||||
-lib kiss-firefox
|
||||
-cp externs
|
||||
-cp src
|
||||
-dce full
|
||||
--each
|
||||
--main pixabay_sourcer.Main
|
||||
--js bin/main.js
|
||||
--next
|
||||
--main pixabay_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
|
@@ -1,5 +0,0 @@
|
||||
# @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
|
||||
--macro hx.strings.internal.Macros.addDefines()
|
||||
--macro hx.strings.internal.Macros.configureNullSafety()
|
@@ -1,5 +0,0 @@
|
||||
# @install: lix --silent download "haxelib:/hscript#2.5.0" into hscript/2.5.0/haxelib
|
||||
# @run: haxelib run-dir hscript "${HAXE_LIBCACHE}/hscript/2.5.0/haxelib"
|
||||
-cp ${HAXE_LIBCACHE}/hscript/2.5.0/haxelib/
|
||||
-D hscript=2.5.0
|
||||
--macro keep('IntIterator')
|
@@ -1,4 +0,0 @@
|
||||
# @install: lix --silent download "gh://github.com/kiss-lang/kiss-firefox#a81ba4bfd2a5d5ec454e0d49c6bfcc8a332c2bae" into kiss-firefox/0.0.0/github/a81ba4bfd2a5d5ec454e0d49c6bfcc8a332c2bae
|
||||
-lib kiss
|
||||
-cp ${HAXE_LIBCACHE}/kiss-firefox/0.0.0/github/a81ba4bfd2a5d5ec454e0d49c6bfcc8a332c2bae/src/
|
||||
-D kiss-firefox=0.0.0
|
@@ -1,12 +0,0 @@
|
||||
# @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"
|
||||
-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/
|
||||
-D kiss=0.0.1
|
||||
-w -WUnusedPattern
|
||||
--macro kiss.KissFrontend.use()
|
@@ -1,3 +0,0 @@
|
||||
# @install: lix --silent download "haxelib:/tink_core#2.1.0" into tink_core/2.1.0/haxelib
|
||||
-cp ${HAXE_LIBCACHE}/tink_core/2.1.0/haxelib/src
|
||||
-D tink_core=2.1.0
|
@@ -1,4 +0,0 @@
|
||||
# @install: lix --silent download "haxelib:/tink_json#0.11.0" into tink_json/0.11.0/haxelib
|
||||
-lib tink_typecrawler
|
||||
-cp ${HAXE_LIBCACHE}/tink_json/0.11.0/haxelib/src
|
||||
-D tink_json=0.11.0
|
@@ -1,4 +0,0 @@
|
||||
# @install: lix --silent download "haxelib:/tink_macro#1.0.1" into tink_macro/1.0.1/haxelib
|
||||
-lib tink_core
|
||||
-cp ${HAXE_LIBCACHE}/tink_macro/1.0.1/haxelib/src
|
||||
-D tink_macro=1.0.1
|
@@ -1,3 +0,0 @@
|
||||
-D tink_priority=0.1.3
|
||||
# @install: lix --silent download "gh://github.com/haxetink/tink_priority#ea736d31dc788aae703a2aa415c25d5b80d0e7d1" into tink_priority/0.1.3/github/ea736d31dc788aae703a2aa415c25d5b80d0e7d1
|
||||
-cp ${HAXE_LIBCACHE}/tink_priority/0.1.3/github/ea736d31dc788aae703a2aa415c25d5b80d0e7d1/src
|
@@ -1,6 +0,0 @@
|
||||
# @install: lix --silent download "gh://github.com/haxetink/tink_syntaxhub#b6ea4966bbdee4d176ac8dd5d2d8ae3b362b2f86" into tink_syntaxhub/0.6.0/github/b6ea4966bbdee4d176ac8dd5d2d8ae3b362b2f86
|
||||
-lib tink_macro
|
||||
-lib tink_priority
|
||||
-cp ${HAXE_LIBCACHE}/tink_syntaxhub/0.6.0/github/b6ea4966bbdee4d176ac8dd5d2d8ae3b362b2f86/src
|
||||
-D tink_syntaxhub=0.6.0
|
||||
--macro tink.SyntaxHub.use()
|
@@ -1,4 +0,0 @@
|
||||
# @install: lix --silent download "haxelib:/tink_typecrawler#0.7.0" into tink_typecrawler/0.7.0/haxelib
|
||||
-lib tink_macro
|
||||
-cp ${HAXE_LIBCACHE}/tink_typecrawler/0.7.0/haxelib/src
|
||||
-D tink_typecrawler=0.7.0
|
@@ -1,3 +0,0 @@
|
||||
# @install: lix --silent download "haxelib:/uuid#2.4.1" into uuid/2.4.1/haxelib
|
||||
-cp ${HAXE_LIBCACHE}/uuid/2.4.1/haxelib/src
|
||||
-D uuid=2.4.1
|
Binary file not shown.
Before Width: | Height: | Size: 225 B |
@@ -1,34 +0,0 @@
|
||||
{
|
||||
|
||||
"manifest_version": 2,
|
||||
"name": "pixabay-sourcer",
|
||||
"version": "0.0",
|
||||
|
||||
"description": "",
|
||||
|
||||
"icons": {
|
||||
"48": "icons/icon-48.png"
|
||||
},
|
||||
"content_scripts": [
|
||||
{
|
||||
"matches": ["https://pixabay.com/photos/*/"],
|
||||
"js": ["bin/browser-polyfill.js", "bin/main.js"]
|
||||
}
|
||||
],
|
||||
"background": {
|
||||
"scripts": [
|
||||
"bin/browser-polyfill.js",
|
||||
"bin/background.js"
|
||||
]
|
||||
},
|
||||
"browser_specific_settings": {
|
||||
"gecko": {
|
||||
"id": "{0d44525b-9803-4630-917d-585c3b538fcb}"
|
||||
}
|
||||
},
|
||||
"permissions": [
|
||||
"<all_urls>",
|
||||
"storage",
|
||||
"downloads"
|
||||
]
|
||||
}
|
@@ -1,82 +0,0 @@
|
||||
{
|
||||
"name": "template",
|
||||
"version": "0.0.0",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "template",
|
||||
"version": "0.0.0",
|
||||
"hasInstallScript": true,
|
||||
"dependencies": {
|
||||
"@types/webextension-polyfill": "^0.10.0",
|
||||
"webextension-polyfill": "^0.10.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"dts2hx": "^0.19.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@types/webextension-polyfill": {
|
||||
"version": "0.10.0",
|
||||
"resolved": "https://registry.npmjs.org/@types/webextension-polyfill/-/webextension-polyfill-0.10.0.tgz",
|
||||
"integrity": "sha512-If4EcaHzYTqcbNMp/FdReVdRmLL/Te42ivnJII551bYjhX19bWem5m14FERCqdJA732OloGuxCRvLBvcMGsn4A=="
|
||||
},
|
||||
"node_modules/dts2hx": {
|
||||
"version": "0.19.2",
|
||||
"resolved": "https://registry.npmjs.org/dts2hx/-/dts2hx-0.19.2.tgz",
|
||||
"integrity": "sha512-1+X3kOB941APt/O6b5jX9+XMefRPqvFk4fvGDHPLIbuYdIAjNwcX3XOuZJ9fYtUD7Odn4ACPfK2ql2HWaFrLrg==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"typescript": "3.7.4"
|
||||
},
|
||||
"bin": {
|
||||
"dts2hx": "cli.js"
|
||||
}
|
||||
},
|
||||
"node_modules/typescript": {
|
||||
"version": "3.7.4",
|
||||
"resolved": "https://registry.npmjs.org/typescript/-/typescript-3.7.4.tgz",
|
||||
"integrity": "sha512-A25xv5XCtarLwXpcDNZzCGvW2D1S3/bACratYBx2sax8PefsFhlYmkQicKHvpYflFS8if4zne5zT5kpJ7pzuvw==",
|
||||
"dev": true,
|
||||
"bin": {
|
||||
"tsc": "bin/tsc",
|
||||
"tsserver": "bin/tsserver"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=4.2.0"
|
||||
}
|
||||
},
|
||||
"node_modules/webextension-polyfill": {
|
||||
"version": "0.10.0",
|
||||
"resolved": "https://registry.npmjs.org/webextension-polyfill/-/webextension-polyfill-0.10.0.tgz",
|
||||
"integrity": "sha512-c5s35LgVa5tFaHhrZDnr3FpQpjj1BB+RXhLTYUxGqBVN460HkbM8TBtEqdXWbpTKfzwCcjAZVF7zXCYSKtcp9g=="
|
||||
}
|
||||
},
|
||||
"dependencies": {
|
||||
"@types/webextension-polyfill": {
|
||||
"version": "0.10.0",
|
||||
"resolved": "https://registry.npmjs.org/@types/webextension-polyfill/-/webextension-polyfill-0.10.0.tgz",
|
||||
"integrity": "sha512-If4EcaHzYTqcbNMp/FdReVdRmLL/Te42ivnJII551bYjhX19bWem5m14FERCqdJA732OloGuxCRvLBvcMGsn4A=="
|
||||
},
|
||||
"dts2hx": {
|
||||
"version": "0.19.2",
|
||||
"resolved": "https://registry.npmjs.org/dts2hx/-/dts2hx-0.19.2.tgz",
|
||||
"integrity": "sha512-1+X3kOB941APt/O6b5jX9+XMefRPqvFk4fvGDHPLIbuYdIAjNwcX3XOuZJ9fYtUD7Odn4ACPfK2ql2HWaFrLrg==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"typescript": "3.7.4"
|
||||
}
|
||||
},
|
||||
"typescript": {
|
||||
"version": "3.7.4",
|
||||
"resolved": "https://registry.npmjs.org/typescript/-/typescript-3.7.4.tgz",
|
||||
"integrity": "sha512-A25xv5XCtarLwXpcDNZzCGvW2D1S3/bACratYBx2sax8PefsFhlYmkQicKHvpYflFS8if4zne5zT5kpJ7pzuvw==",
|
||||
"dev": true
|
||||
},
|
||||
"webextension-polyfill": {
|
||||
"version": "0.10.0",
|
||||
"resolved": "https://registry.npmjs.org/webextension-polyfill/-/webextension-polyfill-0.10.0.tgz",
|
||||
"integrity": "sha512-c5s35LgVa5tFaHhrZDnr3FpQpjj1BB+RXhLTYUxGqBVN460HkbM8TBtEqdXWbpTKfzwCcjAZVF7zXCYSKtcp9g=="
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,16 +0,0 @@
|
||||
{
|
||||
"name": "template",
|
||||
"version": "0.0.0",
|
||||
"description": "A Firefox extension made with Kisslang",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"postinstall": "dts2hx --all --noLibWrap"
|
||||
},
|
||||
"dependencies": {
|
||||
"@types/webextension-polyfill": "^0.10.0",
|
||||
"webextension-polyfill": "^0.10.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"dts2hx": "^0.19.0"
|
||||
}
|
||||
}
|
@@ -1,16 +0,0 @@
|
||||
package pixabay_sourcer;
|
||||
|
||||
import kiss.Prelude;
|
||||
import kiss_firefox.API;
|
||||
import haxe.Constraints;
|
||||
import pixabay_sourcer.Message;
|
||||
import haxe.io.Path;
|
||||
import js.html.File;
|
||||
import js.html.URL;
|
||||
|
||||
@:build(kiss.Kiss.build())
|
||||
class Background {
|
||||
static function main() {
|
||||
_main();
|
||||
}
|
||||
}
|
@@ -1,19 +0,0 @@
|
||||
(function _main []
|
||||
(API.browser.runtime.onMessage.addListener ->[:Message message sender sendResponse]
|
||||
(let [:Function sendResponse sendResponse]
|
||||
(case message
|
||||
((object type "download" 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))]
|
||||
(let [dlItem (first dlItems)
|
||||
fileName dlItem.filename
|
||||
txtFileName "$(Path.withoutDirectory (Path.withoutExtension fileName)).txt"
|
||||
txtContent "${imageInfo.pageURL}\t${imageInfo.user}\t${imageInfo.user_id}"
|
||||
file (new File [txtContent] txtFileName)
|
||||
txtUrl (URL.createObjectURL file)]
|
||||
(awaitLet [txtDownloadId (API.browser.downloads.download (object url txtUrl filename txtFileName))]
|
||||
(catch [e] (sendResponse e))
|
||||
(API.browser.downloads.show txtDownloadId)))))
|
||||
(never otherwise))
|
||||
true)))
|
@@ -1,7 +0,0 @@
|
||||
package pixabay_sourcer;
|
||||
|
||||
class Main {
|
||||
static function main() {
|
||||
Main_.main();
|
||||
}
|
||||
}
|
@@ -1,51 +0,0 @@
|
||||
(import kiss_firefox.API)
|
||||
(import js.lib.Promise)
|
||||
(importAs js.html.XMLHttpRequest XHR)
|
||||
(import pixabay_sourcer.Message)
|
||||
(var :Dynamic document js.Lib.global.document)
|
||||
(var :Dynamic window js.Lib.global.window)
|
||||
|
||||
(var PIXABAY_PUBLIC_KEY "24159230-ce68ffe06827131f3f991f4f6")
|
||||
(var API_URL "https://pixabay.com/api/")
|
||||
|
||||
(function syncedStorage []
|
||||
(API.browser.storage.sync.get (object queries (new Map<String,Dynamic>))))
|
||||
|
||||
(function queryId [:String id :Map<String,Dynamic> cache]
|
||||
(let [request (new XHR)
|
||||
apiQuery "${API_URL}?key=${PIXABAY_PUBLIC_KEY}&id=$id"]
|
||||
(request.open "GET" apiQuery)
|
||||
(request.addEventListener "readystatechange"
|
||||
->:Void
|
||||
(cond
|
||||
((and (= request.readyState 4) (= request.status 200))
|
||||
(let [data (haxe.Json.parse request.responseText)]
|
||||
(dictSet cache id data)
|
||||
(API.browser.storage.sync.set (object queries cache))
|
||||
(handleInfo data)))
|
||||
((= request.readyState 4)
|
||||
// TODO report failure
|
||||
)))
|
||||
(request.send)))
|
||||
|
||||
(function handleInfo [:Dynamic info]
|
||||
(awaitLet [response (API.browser.runtime.sendMessage (object type "download" data [(first info.hits)]))]
|
||||
(print response)))
|
||||
|
||||
(window.addEventListener "load"
|
||||
->:Void
|
||||
(awaitLet [storage (syncedStorage)]
|
||||
(let [:Map<String,Dynamic> cachedResults (dictGet storage "queries")
|
||||
:String url window.location.href
|
||||
parts (url.split "/")
|
||||
_ (parts.pop)
|
||||
titleAndId (parts.pop)
|
||||
id (.pop (titleAndId.split "-"))
|
||||
sourceLink (document.createElement "a")]
|
||||
(set sourceLink.innerHTML "Source this image")
|
||||
(sourceLink.addEventListener "click"
|
||||
->:Void
|
||||
(ifLet [cachedInfo (dictGet cachedResults id)]
|
||||
(handleInfo cachedInfo)
|
||||
(queryId id cachedResults)))
|
||||
(document.body.prepend sourceLink))))
|
@@ -1,6 +0,0 @@
|
||||
package pixabay_sourcer;
|
||||
|
||||
typedef Message = {
|
||||
type:String,
|
||||
data:Array<Dynamic>
|
||||
};
|
@@ -1,7 +0,0 @@
|
||||
#! /bin/bash
|
||||
|
||||
if [ ! -d node_modules ]; then
|
||||
npm install
|
||||
fi
|
||||
|
||||
haxe -D test build.hxml
|
Reference in New Issue
Block a user