Skip to content

Commit

Permalink
File structure change
Browse files Browse the repository at this point in the history
  • Loading branch information
Brawlence committed Apr 23, 2020
1 parent 3978ae6 commit 8b3d21e
Show file tree
Hide file tree
Showing 14 changed files with 29 additions and 24 deletions.
19 changes: 10 additions & 9 deletions Extension/Background.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,16 @@ var fileNameTemplate = "{handle}@{OR} {name} {caption} {tags}";
function validateAnswer(tagsOrigin, imageHost, requesterPage) {
let match = false;
const validSiteIDs = [
["PX", "pximg", "pixiv"],
["DF", "img.booru.org", "drawfriends"],
["DA", "deviantart", "deviantart"],
["TW", "twimg", "twitter"],
["AS", "artstation", "artstation"],
["HF", "hentai-foundry", "hentai-foundry"],
["TU", "tumblr", "tumblr"],
["VA", "img.booru.org", "vidyart"],
["MW", "medicalwhiskey", "medicalwhiskey"]
["PX", "pximg", "pixiv"],
["DF", "img.booru.org", "drawfriends"],
["DA", "deviantart", "deviantart"],
["TW", "twimg", "twitter"],
["AS", "artstation", "artstation"],
["HF", "hentai-foundry","hentai-foundry"],
["TU", "tumblr", "tumblr"],
["VA", "img.booru.org", "vidyart"],
["MW", "medicalwhiskey","medicalwhiskey"],
["DB", "danbooru", "danbooru"]
];

for (let fingerprint of validSiteIDs) {
Expand Down
3 changes: 3 additions & 0 deletions Extension/Content.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ function safeQuery(selector) {
var puppet = new Object;
puppet.href = "";
puppet.innerText = "";
puppet.innerHTML = "";
trytofail = puppet;
};
return trytofail;
Expand All @@ -106,6 +107,7 @@ function safeQueryA(selector) {
var puppet = new Object;
puppet.href = "";
puppet.innerText = "tagme";
puppet.innerHTML = "";
return [puppet];
};
return trytofail;
Expand All @@ -117,6 +119,7 @@ function safeGetByClass(classSelector) {
var puppet = new Object;
puppet.href = "";
puppet.innerText = " tagme";
puppet.innerHTML = "";
return [puppet];
};
return trytofail;
Expand Down
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions Extension/DB_tagsParser.js → Extension/Parsers/DB.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
"use strict";
var tagsOrigin = "VA";
var tagsOrigin = "DB";
var windowDisplacement = 0;

const styleTargets = "div#tag_list li a";
const styleTargets = "aside section a.search-tag";

function getAuthorHandle() {
return safeQuery('aside section ul.artist-tag-list a.search-tag').innerText;
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion Extension/VA_tagsParser.js → Extension/Parsers/VA.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ function getAuthorName() {
return "";
};

// FIXME: hack, returning drawfriendID in the pictureName category
// FIXME: hack, returning ID in the pictureName category
function getPictureName() {
var lefter = safeQuery('div [id="tag_list"]').innerText.trim();
return "drawfriends_" + lefter.substring(lefter.indexOf('Id: ') + 4, lefter.indexOf('\nPosted: ')); //add the drawfriends_ ID to the tags array
Expand Down
20 changes: 10 additions & 10 deletions Extension/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,52 +14,52 @@
{
"matches": ["*://*.deviantart.com/*"],
"run_at": "document_end",
"js": ["DA_tagsParser.js", "Content.js"]
"js": ["Parsers/DA.js", "Content.js"]
},
{
"matches": ["*://*.artstation.com/*"],
"run_at": "document_end",
"js": ["AS_tagsParser.js", "Content.js"]
"js": ["Parsers/AS.js", "Content.js"]
},
{
"matches": ["*://*.pixiv.net/*", "*://*.pximg.net/*"],
"run_at": "document_end",
"js": ["PX_tagsParser.js", "Content.js"]
"js": ["Parsers/PX.js", "Content.js"]
},
{
"matches": ["*://*.tumblr.com/post/*", "*://*.tumblr.com/image/*"],
"run_at": "document_end",
"js": ["TU_tagsParser.js", "Content.js"]
"js": ["Parsers/TU.js", "Content.js"]
},
{
"matches": ["*://*.twitter.com/*", "*://*.twimg.com/*"],
"run_at": "document_end",
"js": ["TW_tagsParser.js", "Content.js"]
"js": ["Parsers/TW.js", "Content.js"]
},
{
"matches": ["*://*.hentai-foundry.com/*"],
"run_at": "document_end",
"js": ["HF_tagsParser.js", "Content.js"]
"js": ["Parsers/HF.js", "Content.js"]
},
{
"matches": ["*://drawfriends.booru.org/*s=view*"],
"run_at": "document_end",
"js": ["DF_tagsParser.js", "Content.js"]
"js": ["Parsers/DF.js", "Content.js"]
},
{
"matches": ["*://vidyart.booru.org/*s=view*"],
"run_at": "document_end",
"js": ["VA_tagsParser.js", "Content.js"]
"js": ["Parsers/VA.js", "Content.js"]
},
{
"matches": ["*://danbooru.donmai.us/posts/*"],
"run_at": "document_end",
"js": ["DB_tagsParser.js", "Content.js"]
"js": ["Parsers/DB.js", "Content.js"]
},
{
"matches": ["*://medicalwhiskey.com/?p=*"],
"run_at": "document_end",
"js": ["MW_tagsParser.js", "Content.js"]
"js": ["Parsers/MW.js", "Content.js"]
}
],
"background": {
Expand Down
5 changes: 3 additions & 2 deletions test.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ var Links_to_test = [
"http://medicalwhiskey.com/?p=12513",
"https://www.pixiv.net/artworks/79196939",
"https://twitter.com/ToyNewsInterna1/status/1222547463002681344",
"https://blurryken.tumblr.com/post/185528821532/do-you-want-to-share-a-bubble-tea-with-me"
"https://blurryken.tumblr.com/post/185528821532/do-you-want-to-share-a-bubble-tea-with-me",
"https://danbooru.donmai.us/posts/3278046,json"
];

for (let link in Links_to_test) { window.open(link,"_blank"); };
for (let link of Links_to_test) { window.open(link,"_blank"); };

0 comments on commit 8b3d21e

Please sign in to comment.