Skip to content

Commit

Permalink
first build
Browse files Browse the repository at this point in the history
pertama diupload
  • Loading branch information
frxangelz committed Aug 14, 2021
1 parent 8e95d99 commit 4e410db
Show file tree
Hide file tree
Showing 17 changed files with 7,042 additions and 0 deletions.
66 changes: 66 additions & 0 deletions _locales/en/messages.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
{
"l10nTabName": {
"message":"Localization"
,"description":"name of the localization tab"
}
,"l10nHeader": {
"message":"It does localization too! (this whole tab is, actually)"
,"description":"Header text for the localization section"
}
,"l10nIntro": {
"message":"'L10n' refers to 'Localization' - 'L' an 'n' are obvious, and 10 comes from the number of letters between those two. It is the process/whatever of displaying something in the language of choice. It uses 'I18n', 'Internationalization', which refers to the tools / framework supporting L10n. I.e., something is internationalized if it has I18n support, and can be localized. Something is localized for you if it is in your language / dialect."
,"description":"introduce the basic idea."
}
,"l10nProd": {
"message":"You <strong>are</strong> planning to allow localization, right? You have <em>no idea</em> who will be using your extension! You have no idea who will be translating it! At least support the basics, it's not hard, and having the framework in place will let you transition much more easily later on."
,"description":"drive the point home. It's good for you."
}
,"l10nFirstParagraph": {
"message":"When the options page loads, elements decorated with <strong>data-l10n</strong> will automatically be localized!"
,"description":"inform that <el data-l10n='' /> elements will be localized on load"
}
,"l10nSecondParagraph": {
"message":"If you need more complex localization, you can also define <strong>data-l10n-args</strong>. This should contain <span class='code'>$containerType$</span> filled with <span class='code'>$dataType$</span>, which will be passed into Chrome's i18n API as <span class='code'>$functionArgs$</span>. In fact, this paragraph does just that, and wraps the args in mono-space font. Easy!"
,"description":"introduce the data-l10n-args attribute. End on a lame note."
,"placeholders": {
"containerType": {
"content":"$1"
,"example":"'array', 'list', or something similar"
,"description":"type of the args container"
}
,"dataType": {
"content":"$2"
,"example":"string"
,"description":"type of data in each array index"
}
,"functionArgs": {
"content":"$3"
,"example":"arguments"
,"description":"whatever you call what you pass into a function/method. args, params, etc."
}
}
}
,"l10nThirdParagraph": {
"message":"Message contents are passed right into innerHTML without processing - include any tags (or even scripts) that you feel like. If you have an input field, the placeholder will be set instead, and buttons will have the value attribute set."
,"description":"inform that we handle placeholders, buttons, and direct HTML input"
}
,"l10nButtonsBefore": {
"message":"Different types of buttons are handled as well. &lt;button&gt; elements have their html set:"
}
,"l10nButton": {
"message":"in a <strong>button</strong>"
}
,"l10nButtonsBetween": {
"message":"while &lt;input type='submit'&gt; and &lt;input type='button'&gt; get their 'value' set (note: no HTML):"
}
,"l10nSubmit": {
"message":"a <strong>submit</strong> value"
}
,"l10nButtonsAfter": {
"message":"Awesome, no?"
}
,"l10nExtras": {
"message":"You can even set <span class='code'>data-l10n</span> on things like the &lt;title&gt; tag, which lets you have translatable page titles, or fieldset &lt;legend&gt; tags, or anywhere else - the default <span class='code'>Boil.localize()</span> behavior will check every tag in the document, not just the body."
,"description":"inform about places which may not be obvious, like <title>, etc"
}
}
84 changes: 84 additions & 0 deletions background.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
var total = 0;
var sub_total = 0; // total action per type

var opened_tab_id = 0;

var config = {
enable : 0,
max : 3,
iglike : true,
igfollow : true,
tiktoklike : true,
tiktokfollow: true,
actionType: 3,
}

chrome.runtime.onMessage.addListener(
function(request, sender, sendResponse) {

if (request.action == "set"){
config.enable = request.enable;
config.max = parseInt(request.max);
config.iglike = request.iglike;
config.igfollow = request.igfollow;
config.tiktoklike = request.tiktoklike;
config.tiktokfollow = request.tiktokfollow;
send_enable();
return;
}

if(request.action == "get"){
var vtabid = 0;
if((sender) && (sender.tab) && (sender.tab.id))
vtabid = sender.tab.id;

var message = {action: "set", enable: config.enable, max:config.max, iglike:config.iglike, igfollow:config.igfollow, tiktoklike:config.tiktoklike, tiktokfollow:config.tiktokfollow, actType:config.actionType, tabid:vtabid};
opened_tab_id = vtabid;
sendResponse(message);
if(vtabid !== 0)
send_notify("opened",opened_tab_id);
return;
}

if(request.action == "setActType"){

config.actionType = request.actType;
return;
}

if(request.action == "log"){

console.log(request.log);
return;
}

});

function send_enable(){

chrome.tabs.query({}, function(tabs) {
var message = {action: "set", enable: config.enable, max:config.max, iglike:config.iglike, igfollow:config.igfollow, tiktoklike:config.tiktoklike, tiktokfollow:config.tiktokfollow, actType:config.actionType};
for (var i=0; i<tabs.length; ++i) {
chrome.tabs.sendMessage(tabs[i].id, message);
}
});
}

function send_notify(vaction, vtabid){

chrome.tabs.query({}, function(tabs) {
var message = {action: vaction,tabid: vtabid};
for (var i=0; i<tabs.length; ++i) {
chrome.tabs.sendMessage(tabs[i].id, message);
}
});
}

chrome.tabs.onRemoved.addListener(function(tabid, removed) {

if(tabid == opened_tab_id) {
opened_tab_id = 0;
send_notify("closed", tabid);
}
})

Binary file added icons/icon128.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added icons/icon16.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added icons/icon19.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added icons/icon48.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 4e410db

Please sign in to comment.