Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function INSERT_OR_REMOVE(table, id, callAfter) {
- if (isNaN(id))
- return;
- var parsed = parseInt(id);
- chrome.storage.local.get(table, function (data) {
- if (data[table] == null)
- data[table] = [];
- if (!data[table].includes(id))
- data[table].push(id);
- else
- data[table].remByVal(id);
- chrome.storage.local.set(data);
- if (callAfter) {
- callAfter(data);
- }
- });
- }
- function colorize() {
- chrome.storage.local.get("blocked", function (data) {
- colorizeData(data);
- });
- }
- function colorizeData(data) {
- var buttons = $("div.base-btn").closest("table");
- for (i = 0; i < buttons.length; i++) {
- var id = $(buttons[i]).attr("data-id");
- if (data["blocked"].includes(id))
- $(buttons[i]).parent().addClass('blocked');
- else
- $(buttons[i]).parent().removeClass('blocked');
- }
- }
- //INSERT_OR_REMOVE("blocked", 12, colorizeData);
Advertisement
Add Comment
Please, Sign In to add comment