var __extends = (this && this.__extends) || (function () { var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); // ==UserScript== // @name 4Free-FSE [4chan X Enhancement] // @author ECHibiki - /qa/ // @description 4Free - Free Stuff Enhancments. 7 additional features on top of 4chanX // @version 1.3.11 // @namespace http://verniy.xyz/ // @match *://boards.4chan.org/* // @grant GM_xmlhttpRequest // @run-at document-start // @icon data:image/jpeg;base64,/9j/4AAQSkZJRgABAQEAYABgAAD/4QB4RXhpZgAATU0AKgAAAAgABgExAAIAAAARAAAAVgMBAAUAAAABAAAAaAMDAAEAAAABAAAAAFEQAAEAAAABAQAAAFERAAQAAAABAAAOxFESAAQAAAABAAAOxAAAAABBZG9iZSBJbWFnZVJlYWR5AAAAAYagAACxj//bAEMAAgEBAgEBAgICAgICAgIDBQMDAwMDBgQEAwUHBgcHBwYHBwgJCwkICAoIBwcKDQoKCwwMDAwHCQ4PDQwOCwwMDP/bAEMBAgICAwMDBgMDBgwIBwgMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDP/AABEIAHQAeAMBIgACEQEDEQH/xAAfAAABBQEBAQEBAQAAAAAAAAAAAQIDBAUGBwgJCgv/xAC1EAACAQMDAgQDBQUEBAAAAX0BAgMABBEFEiExQQYTUWEHInEUMoGRoQgjQrHBFVLR8CQzYnKCCQoWFxgZGiUmJygpKjQ1Njc4OTpDREVGR0hJSlNUVVZXWFlaY2RlZmdoaWpzdHV2d3h5eoOEhYaHiImKkpOUlZaXmJmaoqOkpaanqKmqsrO0tba3uLm6wsPExcbHyMnK0tPU1dbX2Nna4eLj5OXm5+jp6vHy8/T19vf4+fr/xAAfAQADAQEBAQEBAQEB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DwU++OPiS+/bi+LlgdQkjs4NJ8H6RLBGzLFeWVvYQXqW0qZ2tGbuKK4PAbzI1wVXKkorjj8H9eRdbSRzn7Svxd1TwZ8GfBPhvSI7XTI9O8PR+Kv7Rtg8epXFxcXtxG8Tzht3kKEQqibTlFyxxivmrWfjh4g1vU0+3XTXzSN8zXUslwxIyM5dyc8n86KK6cGlyM9HM2701/dRa1t99xZvtjC38bLPEFAjfG3nHvuOfwrH1i5ltLS6khllhkhiYxujlWTAOMEc0UVueTLYh/Z28Yah8Nfj94D1jSpvJu9O1+xuIQR8gImjypAx8rKSpHdSRxX3x+21+zf4d+Kf8AwU18X2t81/ax6h4asNXm+ySrGTcLD9nDcqeqW6E+rFietFFaUkrWPPnJ/wBfI+Gbm2W3uJI/mfy5zEGc5YjPf8vpXuP7Id/J4L/a7+EuqaWxstQh8X6VbxzxEq8QluY4mZT2YK7YI7nv0ooohu0aVPs/I/Y/VdcuLi71Hcy/6ZfXnnAIuGK3k5BHHy/RcDHGMYFFFFYm8tz/2Q== // @downloadURL https://update.greasyfork.icu/scripts/39561/4Free-FSE%20%5B4chan%20X%20Enhancement%5D.user.js // @updateURL https://update.greasyfork.icu/scripts/39561/4Free-FSE%20%5B4chan%20X%20Enhancement%5D.meta.js // ==/UserScript== /* Uses: https://github.com/ccd0/4chan-x/wiki/4chan-X-API https://github.com/ECHibiki/4chan-UserScripts/blob/master/MD5%20Filters%20by%20QAJPYOtGo.txt */ /* ## About 4chanX-FSE 4chanX-Free Stuff Enhancements is a userscript that operates with 4chanX to give it additional features. These enhancements were written by me from early 2017 up to 2018 as a way to teach myself how to work with JavaScript while giving something back to the community I took part in. Some of these features are simple, like the password viewer, others are more complex using multiple concurent AJAX calls such as the thread rebuilder or the image adder.
Below is a description of the features this package has to offer. ### Danbooru Image Adder #### Adds images to your posts Adds an image to your post taken from the danbooru's image collection.
Supply it with tags via an autocomplete, set the rating(s/q/e) and it will give an image for you to post with. ### Kita-Yen #### Color text Converts the colors of special symbols from plain black into other prettier colors(yen == purple, kita == dark grey).
#### Hotkeys for Convinience Press ctrl+\ for ¥ Highlights the whole line in purple much like how greentext works
Press ctrl+k for キタ━━━(゚∀゚)━━━!! Highlights just the word in dark gray
### 4chan-Ignoring-Enhancements #### Hides images. Gives the ability to hide images with ___ctrl+shift+click___. Stores in browser memory for new sessions.
Also includes over 20,000 MD5 filters of things like frogs, goldface, guro done by from QAJPYOtGo
https://github.com/ECHibiki/4chan-UserScripts/blob/master/MD5%20Filters%20by%20QAJPYOtGo.txt #### Word Filters Also includes the ability to do word replacements with a regex replacement system.
### Thread Rebuilder #### Rebuild dead threads from scratch Rebuild a thread from 4chan's archive.
Simple system that could use some additions(using 4chan's offsite archives for example) ### Visible Password #### Shows your 4chan post/delete password * Displays your 4chan password in an inputbox. * Top left is the post password, Bottom right is the delete password. * Edit the input boxes to change them. __Note:__ some 4chan boards don't allow custom post passwords. May require cookie manipulation, but this has not yet been tested... */ var Constants = /** @class */ (function () { function Constants() { } Constants.DEFAULT_HIDE_EXPIRATION_TIME = 172800000; Constants.MILLISECONDS_TO_THE_HOUR = 3600000; Constants.HELP_ICON_SOURCE = "data:image/jpeg;base64,/9j/4AAQSkZJRgABAQEAYABgAAD/4QA6RXhpZgAATU0AKgAAAAgAA1EQAAEAAAABAQAAAFERAAQAAAABAAAAAFESAAQAAAABAAAAAAAAAAD/2wBDAAIBAQIBAQICAgICAgICAwUDAwMDAwYEBAMFBwYHBwcGBwcICQsJCAgKCAcHCg0KCgsMDAwMBwkODw0MDgsMDAz/2wBDAQICAgMDAwYDAwYMCAcIDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAz/wAARCABmAGQDASIAAhEBAxEB/8QAHwAAAQUBAQEBAQEAAAAAAAAAAAECAwQFBgcICQoL/8QAtRAAAgEDAwIEAwUFBAQAAAF9AQIDAAQRBRIhMUEGE1FhByJxFDKBkaEII0KxwRVS0fAkM2JyggkKFhcYG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gIEAEBIiBABERAgAgIEAEBIiBABERAgAgIEAEBIiBABERAgAgIEAEBIiBABERAgAgIEAEBIiBABERAgAgIEAEBIiBABERAgAgIEAEBIiBABERAgAgIEAEBIiBABAQIECACAkRAgAjI9xbzUCtI4axs4wAAAABJRU5ErkJggg=="; return Constants; }()); //unassociated functions var Generics = /** @class */ (function () { function Generics() { } Generics.storageAvailable = function (storage_type) { try { var storage = window[storage_type]; storage.setItem('x', 'x'); storage.removeItem('x'); return 1; } catch (e) { return e; } }; //What Browser Generics.detectBrowser = function () { if ((navigator.userAgent.indexOf('Opera') || navigator.userAgent.indexOf('OPR')) != -1) { console.log('Opera'); return 0; } else if (navigator.userAgent.indexOf('Chrome') != -1) { console.log('Chrome'); return 1; } else if (navigator.userAgent.indexOf('Safari') != -1) { console.log('Safari'); return 2; } else if (navigator.userAgent.indexOf('Firefox') != -1) { console.log('FireFox'); return 3; } else if (navigator.userAgent.indexOf('MSIE') != -1) { console.log('IE'); return 4; } else { console.log('Other'); return -1; } }; //gets json keys by regex test Generics.getJSONPropertiesByKeyName = function (JSON_obj, regex_string) { var regex = new RegExp("^" + regex_string + "$"); var rtnArray = Array(); for (var key in JSON_obj) if (regex.test(key)) rtnArray.push(key); return rtnArray; }; //send alert to 4chanx Generics.alert4ChanX = function (message, type, time) { var detail = { type: type, content: message, lifetime: time }; var event = new CustomEvent('CreateNotification', { bubbles: true, detail: detail }); document.dispatchEvent(event); }; Generics.getJSON = function (url, callback, extra) { var all_extra = []; for (var _i = 3; _i < arguments.length; _i++) { all_extra[_i - 3] = arguments[_i]; } var xhr = new XMLHttpRequest(); xhr.open('GET', url, true); xhr.responseType = 'json'; xhr.onload = function () { var status = xhr.status; if (status == 200) { callback.apply(void 0, [null, xhr.response, extra].concat(all_extra)); } else { callback(status); } }; xhr.send(); }; return Generics; }()); var FeatureInterface = /** @class */ (function () { function FeatureInterface() { } return FeatureInterface; }()); var TopBar = /** @class */ (function () { function TopBar() { this.shortcuts_container = document.getElementById("shortcuts"); this.shortcuts_menu = document.getElementById("shortcut-menu"); this.fse_icon_container = document.createElement("SPAN"); this.fse_icon_node = document.createElement("A"); this.fse_style_node = document.createElement("STYLE"); this.fa_fse_style = ".fa_jpy::before{content:'\f157'}"; this.fse_style_node.innerHTML = this.fa_fse_style; this.fse_icon_container.setAttribute("class", "shortcut brackets-wrap"); this.fse_icon_node.setAttribute("class", "fa fa-jpy"); this.fse_icon_node.setAttribute("href", "javascript:void(0);"); this.fse_icon_node.setAttribute("title", "4F-FSE Settings"); this.fse_icon_node.textContent = "4F-FSE Settings"; this.settings_window = new SettingsWindow(); } TopBar.prototype.build = function () { var _this = this; document.head.appendChild(this.fse_style_node); this.fse_icon_container.appendChild(this.fse_icon_node); this.shortcuts_container.insertBefore(this.fse_icon_container, this.shortcuts_menu); //https://stackoverflow.com/questions/44606399/typescript-how-to-access-the-class-instance-from-event-handler-method this.fse_icon_node.addEventListener("click", function (evt) { return _this.open4FSettings(_this.settings_window); }); }; TopBar.prototype.open4FSettings = function (settings_window) { settings_window.displayWindow(); }; TopBar.prototype.getSettingsArr = function () { return this.settings_window.getSettingsArr(); }; return TopBar; }()); var ImageHider = /** @class */ (function (_super) { __extends(ImageHider, _super); function ImageHider() { var _this = _super.call(this) || this; _this.listener_obj = {}; _this.retrieveStates(); _this.init(); _this.activate(); return _this; } //retrieve from memory the hidden images //Images are stored in memory as fIMG and recalled using the storage_key //Function makes a check to see if the hiding time limit for the thread has expired or not. //Note: Must have the DOM itterate through before retrieval ImageHider.prototype.retrieveStates = function () { var _this = this; var storage_position = 0; var JSON_storage = {}; /*;any bypasses dot notation issues on objects*/ var storage_key; var local_store_size = window.localStorage.length; while (storage_position < local_store_size) { storage_key = window.localStorage.key(storage_position); JSON_storage[storage_key] = window.localStorage.getItem(storage_key); storage_position++; } this.threads_to_hide = Generics.getJSONPropertiesByKeyName(JSON_storage, '[0-9]+IMG'); //aquire each time to check for changes this.hide_expiration_time = parseInt(JSON_storage.Expiration_Time); if (this.hide_expiration_time === null) this.hide_expiration_time = Constants.DEFAULT_HIDE_EXPIRATION_TIME; var md5_filters = JSON_storage.MD5_List_FSE; if (md5_filters !== undefined && md5_filters !== null) { this.md5_filters_arr = md5_filters.split('\n'); //remove trailing and starting slash this.md5_filters_arr.forEach(function (md5, index) { md5 = md5.trim(); _this.md5_filters_arr[index] = md5.substring(1, md5.length - 1); }); } }; ImageHider.prototype.storeStates = function () { var item_pairs = []; for (var _i = 0; _i < arguments.length; _i++) { item_pairs[_i] = arguments[_i]; } window.localStorage.setItem(item_pairs[0], item_pairs[1]); }; ImageHider.prototype.init = function () { this.hotkeyListeners(); }; //hide image onclick listener. //Method 404's a given image. This 404'ing allows image dissabling to be toggled on and off. //Post number associated with the image is stored in local storage. ImageHider.prototype.hideOnClick = function (event) { var is_hidden = event.target.src.substring(21, 29) == ",iVBORw0"; var hide_group_id; if (((this.listener_obj[17] || this.listener_obj[91]) && this.listener_obj[16]) && !is_hidden) { event.preventDefault(); event.stopPropagation(); hide_group_id = event.target.getAttribute('hide-grouping'); this.storeStates(hide_group_id, "" + Date.now()); [].slice.call(document.querySelectorAll('img[hide-grouping="' + hide_group_id + '"]')).forEach(function (image_node) { image_node.setAttribute('hidden-src', image_node.src); image_node.src = Constants.BLANK_PNG; }); } else if ((this.listener_obj[17] || this.listener_obj[91]) && this.listener_obj[16]) { event.preventDefault(); event.stopPropagation(); hide_group_id = event.target.getAttribute('hide-grouping'); window.localStorage.removeItem(hide_group_id); event.target.src = event.target.getAttribute('hidden-src'); [].slice.call(document.querySelectorAll('img[hide-grouping="' + hide_group_id + '"]')).forEach(function (image_node) { image_node.src = image_node.getAttribute('hidden-src'); }); } this.retrieveStates(); return true; }; //hotkeys for ctrl[17] and shift[16] ImageHider.prototype.hotkeyListeners = function () { var _this = this; window.addEventListener("keydown", function (e) { _this.listener_obj[e.keyCode] = true; }, { passive: false, capture: false, once: false }); window.addEventListener("keyup", function (e) { _this.listener_obj[e.keyCode] = false; }, { passive: false, capture: false, once: false }); }; ImageHider.prototype.decideAction = function (node) { //tagname is always upper in HTML, in xml it's displayed as written. if (node.tagName === 'IMG' || node.tagName === 'VIDEO') { if (node.id === "ihover") { this.hideHoverImageNode(node); return; } if (node.getAttribute('data-md5') !== null) { this.hideImageNode(node); } } }; //Activate ImageHider.prototype.activate = function () { console.log("4F-FSE: ImageHider Active"); }; ImageHider.prototype.hideImageNode = function (image_node) { var _this = this; var sister_node = image_node.parentNode.parentNode.parentNode.getElementsByClassName('catalog-thumb')[0]; // the catalog sister to index var sister_node_non_exist = false; if (sister_node === undefined) { sister_node_non_exist = true; } var image_node_already_run = false; if (/\d+IMG/.test(image_node.getAttribute('hide-grouping'))) { image_node_already_run = true; if (!sister_node_non_exist) { if (/\d+IMG/.test(sister_node.getAttribute('hide-grouping'))) { return; } } } if (!image_node_already_run) image_node.setAttribute('hide-grouping', image_node.parentNode.parentNode.id.substring(1) + 'IMG'); if (!sister_node_non_exist) sister_node.setAttribute('hide-grouping', image_node.parentNode.parentNode.id.substring(1) + 'IMG'); if (!image_node_already_run) image_node.addEventListener('click', function (evt) { return _this.hideOnClick(evt); }); if (!sister_node_non_exist) sister_node.addEventListener('click', function (evt) { return _this.hideOnClick(evt); }); var threadstore_len = this.threads_to_hide.length; var node_group_id = image_node.getAttribute('hide-grouping'); for (var thread = 0; thread < threadstore_len; thread++) { if (node_group_id == this.threads_to_hide[thread]) { if (!image_node_already_run) { image_node.setAttribute('hidden-src', image_node.src); image_node.src = Constants.BLANK_PNG; } if (!sister_node_non_exist) { sister_node.setAttribute('hidden-src', sister_node.src); sister_node.src = Constants.BLANK_PNG; } return; } } //index node holds the MD5 var node_md5 = image_node.getAttribute('data-md5'); if (this.md5_filters_arr !== undefined) { var md5_filters_arr_len = this.md5_filters_arr.length; for (var md5 = 0; md5 < md5_filters_arr_len; md5++) { if (node_md5 == this.md5_filters_arr[md5]) { this.threads_to_hide.push(); if (!image_node_already_run) { image_node.setAttribute('hidden-src', image_node.src); image_node.src = Constants.BLANK_PNG; } if (!sister_node_non_exist) { sister_node.setAttribute('hidden-src', sister_node.src); sister_node.src = Constants.BLANK_PNG; } return; } } } }; ImageHider.prototype.hideHoverImageNode = function (image_node) { var unprocessed_id = image_node.getAttribute('data-full-i-d'); var proccessed_id = unprocessed_id.substring(unprocessed_id.indexOf('.') + 1); var image_node_id = proccessed_id + 'IMG'; if (image_node === undefined) return; for (var thread = 0, threadstore_len = this.threads_to_hide.length; thread < threadstore_len; thread++) { if (image_node_id == this.threads_to_hide[thread]) { image_node.removeAttribute('src'); return; } } //thread node holds the MD5 var node_md5; // if(is_embeded_post) node_md5 = image_node.getAttribute('data-md5'); /*else */ node_md5 = document.getElementById('f' + proccessed_id).getElementsByTagName('IMG')[0].getAttribute('data-md5'); if (this.md5_filters_arr !== undefined) { for (var md5 = 0, md5_filters_arr_len = this.md5_filters_arr.length; md5 < md5_filters_arr_len; md5++) { if (node_md5 == this.md5_filters_arr[md5]) { image_node.removeAttribute('src'); return; } } } }; return ImageHider; }(FeatureInterface)); var TextReplacer = /** @class */ (function (_super) { __extends(TextReplacer, _super); function TextReplacer() { var _this = _super.call(this) || this; _this.text_filters = []; //object _this.filtered_threads = []; _this.retrieveStates(); _this.init(); _this.activate(); return _this; } TextReplacer.prototype.init = function () { this.filtered_threads = []; }; ; TextReplacer.prototype.activate = function () { console.log("4F-FSE: TextReplacer Active"); }; TextReplacer.prototype.decideAction = function (node) { if (node.tagName == "BLOCKQUOTE") { if (node.className == "postMessage") { var blockquote_id = node.id; var already_filtered = false; this.filtered_threads.forEach(function (thread_id) { if (thread_id == blockquote_id) { already_filtered = true; return; } }); } else return; if (!already_filtered && this.text_filters.length !== 0) { var itterator = document.createNodeIterator(node, NodeFilter.SHOW_TEXT); var localNode; while ((localNode = itterator.nextNode())) { for (var filter = 0; filter < this.number_of_filters; filter++) { if (this.text_filters[filter].Active === "true") { var last_slash_index = this.text_filters[filter].Regex.lastIndexOf("/"); var filter_text = this.text_filters[filter].Regex.substring(1, last_slash_index); var flag = this.text_filters[filter].Regex.substring(last_slash_index + 1); var regex = new RegExp(filter_text, flag); var node_text = localNode.textContent; if (regex.test(node_text)) { localNode.textContent = node_text.replace(regex, this.text_filters[filter].Replacement); this.filtered_threads.push(blockquote_id); } } } } } } }; TextReplacer.prototype.retrieveStates = function () { var _this = this; var storage_index = 0; var JSON_storage = {}; var storage_key; while (storage_index < window.localStorage.length) { storage_key = window.localStorage.key(storage_index); JSON_storage[storage_key] = window.localStorage.getItem(storage_key); storage_index++; } this.number_of_filters = JSON_storage["filter_quantity"]; var filters = Generics.getJSONPropertiesByKeyName(JSON_storage, "[0-9]+FLT"); filters.sort(); filters.forEach(function (filter) { _this.text_filters.push(TextReplacer.formatFilterSettings(JSON_storage[filter])); }); }; //Splits the saved settings into components TextReplacer.formatFilterSettings = function (input) { var processed_input = (input.split('=')).map(function (x) { return decodeURIComponent(x); }); return { Active: processed_input[0], Regex: processed_input[1], Replacement: processed_input[2] }; }; TextReplacer.prototype.storeStates = function () { }; return TextReplacer; }(FeatureInterface)); var DanbooruImageAdder = /** @class */ (function (_super) { __extends(DanbooruImageAdder, _super); function DanbooruImageAdder() { var _this = _super.call(this) || this; _this.timeout_functions = []; _this.img_URL = ""; _this.post_number = 0; _this.page_number = 0; _this.json_page_numbers_used = []; _this.previous_images = []; _this.json_numbers_used = []; _this.previous_page = 9001; _this.subdomain_regex = new RegExp("http(|s)://"); _this.maximum_attempts = 20; _this.time_max = 10; _this.time = 10; _this.init(); return _this; } DanbooruImageAdder.prototype.init = function () { var _this = this; this.time = this.time_max; this.number_of_attempts = this.maximum_attempts; document.addEventListener("QRDialogCreation", function (evt) { _this.enhance4ChanX_HTML(); _this.enhanced4ChanXListeners(); }); }; DanbooruImageAdder.prototype.enhance4ChanX_HTML = function () { var qr_window = document.getElementById("qr"); /*Should I auto open things for the user?*/ // var imagedump_opener:any = document.getElementById("dump-button"); // if(imagedump_opener !== null){imagedump_opener.click();} // else{return;} //image setting html elements. var qr_image_adder_table = document.createElement("TABLE"); qr_image_adder_table.setAttribute("id", "qrImages"); qr_image_adder_table.setAttribute("style", "text-align:center"); qr_window.appendChild(qr_image_adder_table); var options_row = document.createElement("TR"); options_row.setAttribute("ID", "or"); options_row.setAttribute("style", "margin:5px;"); qr_image_adder_table.appendChild(options_row); var checkbox_safe = document.createElement("INPUT"); checkbox_safe.setAttribute("id", "safe"); checkbox_safe.setAttribute("type", "checkbox"); checkbox_safe.checked = true; var checkbox_safe_text = document.createTextNode("Safe"); var checkbox_questionable = document.createElement("INPUT"); checkbox_questionable.setAttribute("id", "questionable"); checkbox_questionable.setAttribute("type", "checkbox"); var checkbox_questionable_text = document.createTextNode("Questionable"); var checkbox_explicit = document.createElement("INPUT"); checkbox_explicit.setAttribute("id", "explicit"); checkbox_explicit.setAttribute("type", "checkbox"); var checkbox_explicit_text = document.createTextNode("Explicit"); options_row.appendChild(checkbox_safe_text); options_row.appendChild(checkbox_safe); options_row.appendChild(checkbox_questionable_text); options_row.appendChild(checkbox_questionable); options_row.appendChild(checkbox_explicit_text); options_row.appendChild(checkbox_explicit); var image_tagging_row = document.createElement("TR"); this.help_icon_container = document.createElement("A"); this.help_icon_container.href = "javascript:void(0)"; this.help_icon_container.title = "Click to View Help!"; var help_icon = document.createElement("IMG"); help_icon.setAttribute("class", "help_icon"); help_icon.src = Constants.HELP_ICON_SOURCE; this.help_icon_container.appendChild(help_icon); image_tagging_row.appendChild(this.help_icon_container); var tooltip_div = document.createElement("DIV"); tooltip_div.innerHTML = "Insert Tags to search from danbooru in the text box to the side.
The URL for the image will be bellow. Some browsers such as chrome allow you to select this text
Do Not Use \"order:\" tags
Do Not Use \"rating:\" tags
For more speed uncheck all boxes!
Submit bugs to my Github"; (tooltip_div).setAttribute("class", "tooltip-4F"); (tooltip_div).setAttribute("id", "tooltipIA"); qr_window.appendChild(tooltip_div); var second_row_nodes = [ document.createTextNode("Tags: "), document.createElement("INPUT"), document.createElement("INPUT"), document.createElement("A"), document.createElement("INPUT"), ]; second_row_nodes.forEach(function (node) { image_tagging_row.appendChild(node); }); qr_image_adder_table.appendChild(image_tagging_row); var auto_complete_row = document.createElement("TR"); auto_complete_row.setAttribute("ID", "auto-complete-row"); auto_complete_row.setAttribute("style", "margin:5px;"); qr_image_adder_table.appendChild(auto_complete_row); second_row_nodes[1].setAttribute("ID", "tag_input"); var option_text_size = 18; second_row_nodes[1].setAttribute("style", "width:44.9%;" + "font-size:" + option_text_size + "px"); second_row_nodes[3].setAttribute("ID", "timer"); second_row_nodes[3].setAttribute("style", "width:20%;margin:0 5px"); second_row_nodes[4].setAttribute("ID", "urlContainer"); second_row_nodes[4].setAttribute("style", "width:75%;margin:5px -25px"); second_row_nodes[4].setAttribute("disabled", ""); second_row_nodes[2].setAttribute("ID", "imageButton"); second_row_nodes[2].setAttribute("type", "button"); second_row_nodes[2].setAttribute("value", "Set Image"); //textarea expansion; qr_window.getElementsByTagName("TEXTAREA")[0].style.width = "110%"; qr_window.appendChild(document.createElement("hr")); }; DanbooruImageAdder.prototype.enhanced4ChanXListeners = function () { var _this = this; this.highQualityImages(); document.getElementById("qr-filerm").addEventListener("click", function (evt) { return _this.clearImage(); }); var qr_reference = document.getElementById("qr"); var tooltip_div = document.getElementById("tooltipIA"); this.help_icon_container.addEventListener("click", function (evt) { if (_this.tool_tip_visible) tooltip_div.setAttribute("style", "z-index:9;padding:5px;border:1px solid black;background-color:white;word-wrap:break-word;display:none;position:absolute;"); else tooltip_div.setAttribute("style", "z-index:9;padding:5px;border:1px solid black;background-color:white;word-wrap:break-word;display:block;position:absolute;" + "left:" + (evt.clientX - qr_reference.getBoundingClientRect().x) + "px;top:" + (evt.clientY - qr_reference.getBoundingClientRect().y) + "px;"); _this.tool_tip_visible = !_this.tool_tip_visible; }); var tag_input = document.getElementById("tag_input"); tag_input.addEventListener("input", function (evt) { _this.setTagInterface(tag_input, document.getElementById("auto-complete-row")); }); document.getElementById("imageButton").addEventListener("click", function (evt) { return _this.activate(); }); }; DanbooruImageAdder.prototype.highQualityImages = function () { var _this = this; var imagedump_file_list = document.getElementById("dump-list"); //used for setting and unsetting high resolution thumbs for dump list. var dumplist_image = ""; var previous_dumplist_image = ""; var observer = new MutationObserver(function (mutate) { dumplist_image = imagedump_file_list.firstChild.style.backgroundImage; if (dumplist_image !== previous_dumplist_image && _this.img_URL !== "") { imagedump_file_list.firstChild.style.backgroundImage = "url(" + _this.img_URL + ")"; previous_dumplist_image = imagedump_file_list.firstChild.style.backgroundImage; } else if (_this.img_URL == "") { } }); observer.observe(imagedump_file_list, { attributes: true, subtree: true, childList: true, characterData: true }); }; DanbooruImageAdder.prototype.activate = function () { var _this = this; //on setimage click clear flags, timers and start another search this.json_page_numbers_used = Array(); this.previous_page = 9001; //reset a failed_to_find_required_tags boolean this.primed_for_fail = false; for (var i = 0; i < this.timeout_functions.length; i++) { clearInterval(this.timeout_functions[i]); } this.tag_incorrect_state = false; this.timeout = false; //freeze interface to prevent mid opperation changes document.getElementById("tag_input").setAttribute("disabled", "1"); document.getElementById("imageButton").setAttribute("disabled", "1"); this.time = this.time_max; this.timeout_functions.push(setInterval(function () { return _this.counterFunction(); }, 1000)); //start the search this.setImage(this); }; //remove the high quallity image from the dump list DanbooruImageAdder.prototype.clearImage = function () { var imagedump_file_list = document.getElementById("dump-list"); imagedump_file_list.firstChild.style.backgroundImage = "url()"; //trigger mutation event this.img_URL = ""; //get mutation to set to dead }; DanbooruImageAdder.prototype.setTagInterface = function (tag_input_node, auto_complete_row) { var tags = tag_input_node.value; if (this.old_tags_before_change !== tags) { this.previous_images = []; var tag_carat_position = tag_input_node.selectionStart - 1; var closest_tag = (function () { var current_chararcter = tags.charAt(tag_carat_position); var i = 0; var right_most = tag_carat_position; while (current_chararcter != " " && current_chararcter != "" && current_chararcter !== undefined) { i++; current_chararcter = tags.charAt(tag_carat_position + i); if (current_chararcter != " " && current_chararcter != "") right_most = tag_carat_position + i; } right_most += 1; current_chararcter = tags.charAt(tag_carat_position); i = 0; var leftMost = tag_carat_position; while (current_chararcter != " " && current_chararcter != "" && current_chararcter !== undefined) { i++; current_chararcter = tags.charAt(tag_carat_position - i); if (current_chararcter != " " && current_chararcter != "") leftMost = tag_carat_position - i; } return tags.substring(leftMost, right_most); })(); var xhr = new GM_xmlhttpRequest(({ method: "GET", url: "https://danbooru.donmai.us/tags.json?search[name_matches]=" + closest_tag + "*&search[order]=count", responseType: "json", onload: function (data) { data = data.response; var tagArray = tags.split(" "); while (auto_complete_row.hasChildNodes()) { auto_complete_row.removeChild(auto_complete_row.lastChild); } var qr_width = document.getElementById("qr").offsetWidth; var tag_table = document.createElement("TABLE"); tag_table.setAttribute("style", "border:1px solid black;margin-top:5px"); var tag_row = document.createElement("TR"); for (var i = 0; i < 5; i++) { var a = document.createElement("A"); var tagText = data["" + i]; if (tagText == "" || tagText === undefined) break; tagText = tagText["name"]; var a_txt = document.createTextNode(data[i]["name"]); var tag_data = document.createElement("TD"); tag_data.setAttribute("style", "padding:5px;font-size:15px;font-weight:bold;border:1px solid black;"); a.appendChild(a_txt); tag_data.appendChild(a); tag_row.appendChild(tag_data); tag_table.appendChild(tag_row); auto_complete_row.appendChild(tag_table); if (tag_table.offsetWidth > qr_width - 10) { tag_row.removeChild(tag_data); tag_table = document.createElement("TABLE"); tag_row = document.createElement("TR"); tag_row.appendChild(tag_data); tag_table.appendChild(tag_row); tag_table.setAttribute("style", "border:1px solid black;"); auto_complete_row.appendChild(tag_table); } a.addEventListener("click", function (evt) { tagArray[tagArray.indexOf(closest_tag)] = this.textContent; document.getElementById("tag_input").value = tagArray.join(" "); }); } } })); } this.old_tags_before_change = tag_input_node.value; }; //a series of calls on other functions that leads to the image being searched for DanbooruImageAdder.prototype.setImage = function (this_) { //Set image tags. var tags = document.getElementById("tag_input").value.trim(); if (tags.indexOf(":") > -1) { Generics.alert4ChanX("Character ':' not used for functional purpose", "warning"); } var tags_arr = tags.split(" "); var xhr_image_load = new GM_xmlhttpRequest(({ method: "GET", //returns a list of all tags and their properties url: "https://danbooru.donmai.us/tags.json?search[name]=" + tags_arr.join() + "&search[order]=count", responseType: "json", onload: function (data) { this_.json_tag = this_.verifyTags(data, tags_arr); if (this_.failed_to_find_required_tags_state) return; //set the end var end_URL = this_.ratingURL(this_.json_tag); var URL = this_.setPostAndPage(end_URL); this_.send_URL = URL; //final check, sends final request after function or calls this function again Generics.getJSON(URL, function (err, data, tags, _this_) { return this_.checkPageFromDanbooru(err, data, tags, _this_); }, tags_arr, this_); } })); }; //make 4chanX alerts on issues, and account for error cases. DanbooruImageAdder.prototype.verifyTags = function (data, tags) { data = data.response; this.json_tag = data; this.failed_to_find_required_tags_state = false; //if data has a null or undefined case, return an error if (data.length == 0) { Generics.alert4ChanX("All tags incorrect", "error", 10); this.failed_to_find_required_tags_state = true; document.getElementById("timer").textContent = ""; document.getElementById("tag_input").removeAttribute("disabled"); document.getElementById("imageButton").removeAttribute("disabled"); return this.json_tag; } else if (data.length != tags.length && !this.tag_incorrect_state) { this.tag_incorrect_state = true; if (document.getElementById("tag_input").value.trim() == "") Generics.alert4ChanX("No Tags", "info", 2); else Generics.alert4ChanX("One Tag Incorrect", "warning"); } //tag size. Smallest tag is placed at bottom of JSON this.smallest_tag_size = parseInt(data[data.length - 1]["post_count"]); return this.json_tag; }; //evaluate the rating restrictions to account for danbooru's tagging limitations DanbooruImageAdder.prototype.ratingURL = function (tags) { var URL = ""; //evaluate the 3! possible permutations if (document.getElementById("safe").checked) { if (document.getElementById("questionable").checked) { if (document.getElementById("explicit").checked) { if (tags.length > 1) URL = "&utf8=%E2%9C%93&tags=" + tags[tags.length - 2]["name"] + "+" + tags[tags.length - 1]["name"]; else URL = "&utf8=%E2%9C%93&tags=" + tags[tags.length - 1]["name"]; } else { URL = "&utf8=%E2%9C%93&tags=" + "-rating%3Aexplicit" + "+" + tags[tags.length - 1]["name"]; } } else if (document.getElementById("explicit").checked) { URL = "&utf8=%E2%9C%93&tags=" + "-rating%3Aquestionable" + "+" + tags[tags.length - 1]["name"]; } else { URL = "&utf8=%E2%9C%93&tags=" + "rating%3Asafe" + "+" + tags[tags.length - 1]["name"]; } } else if (document.getElementById("questionable").checked) { if (document.getElementById("explicit").checked) { URL = "&utf8=%E2%9C%93&tags=" + "-rating%3Asafe" + "+" + tags[tags.length - 1]["name"]; } else { URL = "&utf8=%E2%9C%93&tags=" + "rating%3Aquestionable" + "+" + tags[tags.length - 1]["name"]; } } else if (document.getElementById("explicit").checked) { URL = "&utf8=%E2%9C%93&tags=" + "rating%3Aexplicit" + "+" + tags[tags.length - 1]["name"]; } else { if (tags.length > 1) URL = "&utf8=%E2%9C%93&tags=" + tags[tags.length - 2]["name"] + "+" + tags[tags.length - 1]["name"]; else URL = "&utf8=%E2%9C%93&tags=" + tags[tags.length - 1]["name"]; } return URL; }; //set where to search DanbooruImageAdder.prototype.setPostAndPage = function (end_URL) { this.post_number = 0; //page if (this.top_page != this.top_page_max) this.smallest_tag_size = this.top_page * 20; if (this.smallest_tag_size == 0) this.smallest_tag_size = 100; var escape_cond = true; this.page_number = ((Math.floor(Math.random() * 10000)) % Math.ceil(this.smallest_tag_size / 20)) % 1000; //1000 is max page search limit if (this.page_number == 0 && this.previous_page == 0) { this.primed_for_fail = true; } this.json_numbers_used.push(this.page_number); this.previous_page = this.page_number; var URL = "https://danbooru.donmai.us/posts.json?page=" + this.page_number + end_URL; return URL; }; //check if valid url location DanbooruImageAdder.prototype.checkPageFromDanbooru = function (err, data, tags, this_arr) { if (err != null) { console.log('Something went wrong: ' + err); Generics.alert4ChanX("Danbooru Server Did Not Perform request -- Error: " + err, "error"); document.getElementById("timer").textContent = ""; document.getElementById("tag_input").removeAttribute("disabled"); document.getElementById("imageButton").removeAttribute("disabled"); } else { do { var duplicate = false; //check for repeating images found this_arr.previous_images.forEach(function (item) { if (item[0] == this_arr.page_number && item[1] == this_arr.post_number) { duplicate = true; this_arr.post_number++; } }); } while (duplicate); this_arr.number_of_attempts--; if (this_arr.primed_for_fail) { Generics.alert4ChanX("No Results: All found for tags \"" + document.getElementById("tag_input").value + "\"", "error"); this_arr.reset_search_timer_fields(); return; } else if ((data.length < this_arr.post_number + 1) && this_arr.number_of_attempts > 0) { if (this_arr.top_page > this_arr.page_number) { this_arr.top_page = this_arr.page_number + this_arr.post_number / 20; } //posts this_arr.post_number = 0; document.getElementById("timer").textContent = this_arr.number_of_attempts + "|" + this_arr.time; this_arr.setImage(this_arr); } else if (this_arr.number_of_attempts > 0) { //ALL PARAMETERS WILL BE RESET INSIDE JSON document.getElementById("timer").textContent = this_arr.number_of_attempts + "|" + this_arr.time; Generics.getJSON(this_arr.send_URL, function (err, data, tags, _this_arr) { return this_arr.setImageFromDanbooru(err, data, tags, _this_arr); }, tags, this_arr); } else { Generics.alert4ChanX("Not found", "error"); this_arr.reset_search_timer_fields(); return; } } }; DanbooruImageAdder.prototype.reset_search_timer_fields = function () { this.top_page = this.top_page_max; this.number_of_attempts = this.maximum_attempts; document.getElementById("timer").textContent = ""; document.getElementById("tag_input").removeAttribute("disabled"); document.getElementById("imageButton").removeAttribute("disabled"); }; //finally draw from the JSON page to generate and place the post into the 4chanX dumplist DanbooruImageAdder.prototype.setImageFromDanbooru = function (err, data, tags, this_arr) { if (err != null) { console.log('Something went wrong: ' + err); Generics.alert4ChanX("Danbooru Server Did Not Perform request -- Error: " + err, "error"); document.getElementById("timer").textContent = ""; document.getElementById("tag_input").removeAttribute("disabled"); document.getElementById("imageButton").removeAttribute("disabled"); } else { this_arr.json_page = data; var image_found = false; for (this_arr.post_number = this_arr.post_number; this_arr.post_number < 20; this_arr.post_number++) { if (this_arr.timeout) { //Case1: Took too long to scan the page. //Result: Kills search Generics.alert4ChanX("timeout after " + this_arr.time + " seconds", "error"); for (var i = 0; i < this_arr.timeout_functions.length; i++) { clearInterval(this_arr.timeout_functions[i]); } this_arr.reset_search_timer_fields(); return; } else if (this_arr.json_page["" + this_arr.post_number] == undefined) { //Case2: reaches an undefined page. //Result: Switches to a new page this_arr.top_page = this_arr.page_number; this_arr.setImage(this_arr); return; } //set the page to search var end_URL = this_arr.json_page["" + this_arr.post_number].file_url; var URL = "https://danbooru.donmai.us" + end_URL; if (this_arr.subdomain_regex.test(end_URL)) URL = end_URL; //place url in visible box this_arr.urlContainterFunction(URL); /* :{id: 3038118, created_at: "2018-03-02T15:27:56.469-05:00", uploader_id: 49091, score: 6,…} approver_id:null bit_flags:0 children_ids:null created_at:"2018-03-02T15:27:56.469-05:00" down_score:0 fav_count:10 fav_string:"fav:553974 fav:467363 fav:455311 fav:490034 fav:505064 fav:482030 fav:351935 fav:66907 fav:467355 fav:519151" file_ext:"jpg" file_size:30492 file_url:"/data/__miyuki_kantai_collection_drawn_by_kumadano__7a12a196cc1aa9f794bca81a2a14bb81.jpg" has_active_children:false has_children:false has_large:false has_visible_children:false id:3038118 image_height:800 image_width:450 is_banned:false is_deleted:false is_flagged:false is_note_locked:false is_pending:false is_rating_locked:false is_status_locked:false large_file_url:"/data/__miyuki_kantai_collection_drawn_by_kumadano__7a12a196cc1aa9f794bca81a2a14bb81.jpg" last_comment_bumped_at:null last_commented_at:null last_noted_at:null md5:"7a12a196cc1aa9f794bca81a2a14bb81" parent_id:null pixiv_id:null pool_string:"" preview_file_url:"/data/preview/7a12a196cc1aa9f794bca81a2a14bb81.jpg" rating:"s" score:6 source:"https://twitter.com/kumadano/status/969629578137251840" tag_count:28 tag_count_artist:1 tag_count_character:1 tag_count_copyright:1 tag_count_general:24 tag_count_meta:1 tag_string:"1girl black_legwear blue_sailor_collar blue_skirt brown_eyes brown_hair commentary_request full_body grin kantai_collection kumadano miyuki_(kantai_collection) pleated_skirt ribbon sailor_collar school_uniform serafuku short_hair short_sleeves simple_background skirt smile socks solo standing wavy_hair white_background wrists_extended" tag_string_artist:"kumadano" tag_string_character:"miyuki_(kantai_collection)" tag_string_copyright:"kantai_collection" tag_string_general:"1girl black_legwear blue_sailor_collar blue_skirt brown_eyes brown_hair full_body grin pleated_skirt ribbon sailor_collar school_uniform serafuku short_hair short_sleeves simple_background skirt smile socks solo standing wavy_hair white_background wrists_extended" tag_string_meta:"commentary_request" up_score:6 updated_at:"2018-03-03T09:09:32.357-05:00" uploader_id:49091 uploader_name:"---" */ var failed_to_find_required_tags = false; if (end_URL === undefined || end_URL.indexOf(".mp4") > -1 || end_URL.indexOf(".webm") > -1 || end_URL.indexOf(".swf") > -1 || end_URL.indexOf(".zip") > -1) { continue; } else { tags.forEach(function (tag) { //if tag contains an order then whatever if (tag.indexOf("order:") > -1) { } else if (tag.indexOf("rating:") > -1) { if (tag.charAt(7) !== this_arr.json_page["" + this_arr.post_number]["rating"]) { failed_to_find_required_tags = true; } } else if (this_arr.json_page["" + this_arr.post_number]["tag_string"].indexOf(tag) == -1) { failed_to_find_required_tags = true; } }); } if (failed_to_find_required_tags) { continue; } else { if (this_arr.json_page["" + this_arr.post_number].file_size >= 4000000) { var end_URL = this_arr.json_page["" + this_arr.post_number].large_file_url; var URL = "https://danbooru.donmai.us" + end_URL; if (this_arr.subdomain_regex.test(end_URL)) URL = end_URL; } document.getElementById("timer").textContent = "..."; this_arr.img_URL = URL; var xhr = new GM_xmlhttpRequest(({ method: "GET", url: URL, responseType: "arraybuffer", onload: function (response) { //is it a non existent image? if (response.response.byteLength <= 387) { Generics.alert4ChanX("Image Does Not Exist on Danbooru(404 error)\nDanbooru seems to be updating image servers???", "error"); } var blob; if (end_URL.indexOf(".jpg") > -1) blob = new Blob([response.response], { type: "image/jpeg" }); else if (end_URL.indexOf(".png") > -1) blob = new Blob([response.response], { type: "image/png" }); else if (end_URL.indexOf(".gif") > -1) blob = new Blob([response.response], { type: "image/gif" }); var counter = document.getElementById("timer"); while (counter.hasChildNodes()) counter.removeChild(counter.lastChild); this_arr.reset_search_timer_fields(); this_arr.time = this_arr.time_max; var name = end_URL.replace(/(data|cached)/g, ""); name = name.replace(/\//g, ""); //SEND RESULTING RESPONSE TO 4CHANX FILES === QRSetFile var detail = { file: blob, name: name }; if (typeof cloneInto === 'function') { detail = cloneInto(detail, document.defaultView); } document.dispatchEvent(new CustomEvent('QRSetFile', { bubbles: true, detail: detail })); } })); //end function; image_found = true; //SET PAGE&POST AS FOUND this_arr.previous_images.push([this_arr.page_number, this_arr.post_number]); this_arr.post_number = 9001; } } if (!image_found) { // this_arr.top_page = this_arr.page_number; this_arr.setImage(this_arr); } } }; DanbooruImageAdder.prototype.urlContainterFunction = function (url) { var url_box = document.getElementById("urlContainer"); url_box.value = url; }; DanbooruImageAdder.prototype.counterFunction = function () { if (!this.timeout) { this.time--; if (this.time < 0) { this.timeout = true; this.time = this.time_max; } } }; DanbooruImageAdder.prototype.decideAction = function (node) { }; DanbooruImageAdder.prototype.retrieveStates = function () { }; DanbooruImageAdder.prototype.storeStates = function () { var items = []; for (var _i = 0; _i < arguments.length; _i++) { items[_i] = arguments[_i]; } }; return DanbooruImageAdder; }(FeatureInterface)); var ThreadRebuilder = /** @class */ (function (_super) { __extends(ThreadRebuilder, _super); function ThreadRebuilder() { var _this = _super.call(this) || this; _this.board = "qa"; _this.thread_data = [['Comment'], ['Image URLs'], ['Image Names'], ['Post No.']]; _this.semaphore = 1; _this.semaphore_posts = 1; _this.use_offsite_archive = false; _this.window_displayed = false; _this.in_sequence = false; _this.tool_top_visible = false; _this.thread_data_length = 0; _this.posts_created = 0; _this.checked = false; _this.init(); return _this; } ThreadRebuilder.prototype.init = function () { var board_uproces = window.location.pathname; this.board = board_uproces.substring(1, board_uproces.length - 1); this.activate(); }; ThreadRebuilder.prototype.retrieveStates = function () { this.use_offsite_archive = localStorage.getItem("ArchiveType") == "0" ? true : false; }; ThreadRebuilder.prototype.storeStates = function () { var items = []; for (var _i = 0; _i < arguments.length; _i++) { items[_i] = arguments[_i]; } }; ThreadRebuilder.prototype.activate = function () { var _this = this; document.addEventListener("QRDialogCreation", function (e) { return _this.enhance4ChanX(); }); document.addEventListener('QRPostSuccessful', function (e) { if (_this.in_sequence) { document.getElementById("dump-list").childNodes[1].click(); _this.setPropperLinking(document.getElementById("qr").getElementsByTagName("TEXTAREA")[0].value); } }, false); }; ThreadRebuilder.prototype.decideAction = function (node) { }; ThreadRebuilder.prototype.enhance4ChanX = function () { var _this = this; var qr_window = document.getElementById("qr"); if (document.getElementById("qrRebuilder") !== null) qr_window.removeChild(document.getElementById("qrRebuilder")); var thread_rebuilder_table = document.createElement("TABLE"); thread_rebuilder_table.setAttribute("id", "qrRebuilder"); thread_rebuilder_table.setAttribute("style", "text-align:center"); qr_window.appendChild(thread_rebuilder_table); var thread_row = document.createElement("TR"); var option_text_size = 18; var help_icon_container = document.createElement("A"); help_icon_container.href = "javascript:void(0)"; help_icon_container.title = "Click to View Help!"; var help_icon = document.createElement("IMG"); help_icon.setAttribute("style", "height:" + option_text_size * 1.25 + "px;margin:-4px 10px"); help_icon.src = Constants.HELP_ICON_SOURCE; help_icon_container.appendChild(help_icon); thread_row.appendChild(help_icon_container); var tooltip_div = document.createElement("DIV"); tooltip_div.innerHTML = "Insert the thread number of the post to rebuild
Must be in either the 4chan archives or archived.moe
Submit bugs to my Github"; tooltip_div.setAttribute("style", "z-index:9;padding:5px;border:1px solid black;background-color:white;word-wrap:break-word;display:none;position:absolute;"); help_icon_container.addEventListener("click", function (evt) { if (_this.tool_top_visible) tooltip_div.setAttribute("style", "z-index:9;padding:5px;border:1px solid black;background-color:white;word-wrap:break-word;display:none;position:absolute;"); else tooltip_div.setAttribute("style", "z-index:9;padding:5px;border:1px solid black;background-color:white;word-wrap:break-word;display:block;position:absolute;" + "left:" + (evt.clientX - qr_window.getBoundingClientRect().x) + "px;top:" + (evt.clientY - qr_window.getBoundingClientRect().y) + "px;"); _this.tool_top_visible = !_this.tool_top_visible; }); qr_window.appendChild(tooltip_div); var second_row_nodes = [ document.createTextNode("Thread: "), document.createElement("INPUT"), document.createElement("INPUT"), ]; second_row_nodes.forEach(function (node) { thread_row.appendChild(node); }); thread_rebuilder_table.appendChild(thread_row); second_row_nodes[1].setAttribute("ID", "threadInput"); second_row_nodes[1].setAttribute("style", "width:35.0%"); second_row_nodes[2].setAttribute("ID", "threadButton"); second_row_nodes[2].setAttribute("type", "button"); second_row_nodes[2].setAttribute("value", "Set Rebuild Queue"); second_row_nodes[2].addEventListener("click", function () { _this.in_sequence = true; _this.killAll(); _this.getThread(second_row_nodes[1].value); _this.postID = setInterval(function () { return _this.postRoutine(); }, 1000); if (_this.timeListen === undefined) _this.timeListen = setInterval(function () { return _this.timeListenerFunction(); }, 1000); }); qr_window.appendChild(document.createElement("hr")); }; ; ThreadRebuilder.prototype.postRoutine = function () { var _this = this; if (this.semaphore == 0) { this.semaphore++; this.thread_data_length = this.thread_data[0].length; this.fillID = setInterval(function () { return _this.fillRoutine(); }, 10); this.stopRoutine(); } }; ; ThreadRebuilder.prototype.stopRoutine = function () { clearInterval(this.postID); }; ; ThreadRebuilder.prototype.fillRoutine = function () { if (this.posts_created >= this.thread_data_length) { this.semaphore_posts = 0; this.stopFillRoutine(); } else if (this.semaphore_posts == 1) { this.semaphore_posts--; this.createPost(this.thread_data[0][this.posts_created], this.thread_data[1][this.posts_created], this.thread_data[2][this.posts_created]); this.posts_created++; } }; ; ThreadRebuilder.prototype.stopFillRoutine = function () { clearInterval(this.fillID); }; ThreadRebuilder.prototype.setPropperLinking = function (text) { var _this = this; var search_regex = RegExp(">>\\d+", "g"); var result; var index_old = -1; var link_arr = Array(); while ((result = search_regex.exec(text)) != null) { var end_index = search_regex.lastIndex; var post_no = result.toString().replace(/>/g, ""); link_arr.push([post_no, end_index]); } //hunt down the text of what it linked to //Get the links inside of the origonal message to show text contents var responding_text = Array(); if (this.use_offsite_archive) var URL = "https://www.archived.moe/_/api/chan/thread/?board=" + this.board + "&num=" + document.getElementById("threadInput").value; else var URL = "https://a.4cdn.org/" + this.board + "/thread/" + document.getElementById("threadInput").value + ".json"; var xhr = new GM_xmlhttpRequest(({ method: "GET", url: URL, responseType: "json", onload: function (data) { if (_this.use_offsite_archive) data = data.response["" + document.getElementById("threadInput").value]["posts"]; else data = data.response["posts"]; if (data == undefined) { alert("Invalid Thread ID: " + document.getElementById("threadInput").value + ". "); } else { link_arr.forEach(function (link_item) { for (var data_entry = 0; data_entry < data.length; data_entry++) { if (parseInt(link_item[0]) == parseInt(data[data_entry]["no"])) { if (_this.use_offsite_archive && data[data_entry]["comment_processed"] !== undefined) responding_text.push([[post_no, end_index], data[data_entry]["comment_processed"].replace(/(>>|https:\/\/www\.archived\.moe\/.*\/thread\/.*\/#)\d+/g, ""), link_item["media"]["safe_media_hash"]]); else if (data[data_entry]["com"] !== undefined) responding_text.push([[post_no, end_index], data[data_entry]["com"].replace(/(>>|#p)\d+/g, ""), data[data_entry]["md5"]]); else responding_text.push([[post_no, end_index], undefined, data[data_entry]["md5"]]); break; } } }); var current_url = window.location.href; var hash_index = current_url.lastIndexOf("#") != -1 ? current_url.lastIndexOf("#") : window.location.href.length; var current_thread = window.location.href.substring(current_url.lastIndexOf("/") + 1, hash_index); var current_url = "https://a.4cdn.org/" + _this.board + "/thread/" + current_thread + ".json"; //open current thread to hunt down the text found in links var xhr = new GM_xmlhttpRequest(({ method: "GET", url: current_url, responseType: "json", onload: function (data) { data = data.response["posts"]; if (data == undefined) { alert("Invalid Thread ID: " + document.getElementById("threadInput").value + ". "); } else { responding_text.forEach(function (response_item) { for (var data_entry = 0; data_entry < data.length; data_entry++) { if (data[data_entry]["com"] !== undefined && (response_item[1] == data[data_entry]["com"].replace(/(>>|#p)\d+/g, "") || response_item[1] == null) && (response_item[2] == data[data_entry]["md5"] || response_item[2] == null)) { var start_index = response_item[0][0].legth - response_item[0][1]; text = text.substring(0, start_index) + ">>" + data[data_entry]["no"] + text.substring(response_item[0][1]); break; } else if (response_item[2] !== undefined && response_item[2] == data[data_entry]["md5"]) { var start_index = response_item[0][0].legth - response_item[0][1]; text = text.substring(0, start_index) + ">>" + data[data_entry]["no"] + text.substring(response_item[0][1]); break; } } }); document.getElementById("qr").getElementsByTagName("TEXTAREA")[0].value = text; document.getElementById("add-post").click(); _this.semaphore_posts++; } } })); } } })); }; ; //2) GET ARCHIVED THREAD ThreadRebuilder.prototype.getThread = function (threadNo) { var _this = this; this.thread_data = [[], [], [], []]; if (this.use_offsite_archive) var URL = "https://www.archived.moe/_/api/chan/thread/?board=" + this.board + "&num=" + document.getElementById("threadInput").value; else var URL = "https://a.4cdn.org/" + this.board + "/thread/" + document.getElementById("threadInput").value + ".json"; var xhr = new GM_xmlhttpRequest(({ method: "GET", url: URL, responseType: "json", onload: function (data) { var starting_post = -1; if (_this.use_offsite_archive) { starting_post = 0; data = data.response["" + document.getElementById("threadInput").value]; } else { starting_post = 1; data = data.response; } if (data == undefined) { alert("Invalid Thread ID: " + threadNo + ".\n4chan Archive "); } else { if (_this.use_offsite_archive) data["posts"] = data.values(data["posts"]); var len = data["posts"].length; for (var post_number = starting_post; post_number < len; post_number++) { var comment = undefined; if (_this.use_offsite_archive) comment = data["posts"][post_number]["comment"]; else comment = data["posts"][post_number]["com"]; if (comment !== undefined && comment !== null) _this.thread_data[0].push(comment); else _this.thread_data[0].push(""); var filename = undefined; if (_this.use_offsite_archive) { if (data["posts"][post_number]["media"] !== null) filename = "" + data["posts"][post_number]["media"]["media_filename"]; } else filename = "" + data["posts"][post_number]["tim"] + data["posts"][post_number]["ext"]; if (filename !== undefined && filename !== null && filename.indexOf("undefined") == -1) if (_this.use_offsite_archive) if (data["posts"][post_number]["media"] !== null) _this.thread_data[1].push(data["posts"][post_number]["media"]["remote_media_link"]); else _this.thread_data[1].push(""); else _this.thread_data[1].push("https://i.4cdn.org/" + _this.board + "/" + filename); else _this.thread_data[1].push(""); if (_this.use_offsite_archive) { if (data["posts"][post_number]["media"] !== null) _this.thread_data[2].push(data["posts"][post_number]["media"]["media_id"]); } else _this.thread_data[2].push(data["posts"][post_number]["filename"]); if (_this.use_offsite_archive) _this.thread_data[3].push(data["posts"][post_number]["num"]); else _this.thread_data[3].push(data["posts"][post_number]["no"]); } } _this.semaphore--; } })); }; ; //3) RIP POSTS AND IMAGES ThreadRebuilder.prototype.createPost = function (text, imageURL, imageName) { var _this = this; if (imageURL != "") { var response_type = "arraybuffer"; if (this.use_offsite_archive) response_type = "text"; var xhr = new GM_xmlhttpRequest(({ method: "GET", url: imageURL, responseType: response_type, onload: function (response) { if (_this.use_offsite_archive) { var parser = new DOMParser(); var content_attribute = parser.parseFromString(response.response, "text/html").getElementsByTagName("META")[0].getAttribute("content"); var redirect_url = content_attribute.substring(content_attribute.indexOf("http")); var xhr = new GM_xmlhttpRequest(({ method: "GET", url: redirect_url, responseType: "arraybuffer", onload: function (response) { _this.inputImage(response, text, imageURL, imageName); } })); } else { _this.inputImage(response, text, imageURL, imageName); } } })); } else { text = this.createPostComment(text); this.setPropperLinking(text); } }; ThreadRebuilder.prototype.inputImage = function (response, text, imageURL, imageName) { var blob; var ext = ".jpg"; if (imageURL.indexOf(".jpg") > -1) { blob = new Blob([response.response], { type: "image/jpeg" }); ext = ".jpg"; } else if (imageURL.indexOf(".png") > -1) { blob = new Blob([response.response], { type: "image/png" }); ext = ".png"; } else if (imageURL.indexOf(".gif") > -1) { blob = new Blob([response.response], { type: "image/gif" }); ext = ".gif"; } else if (imageURL.indexOf(".webm") > -1) { blob = new Blob([response.response], { type: "video/webm" }); ext = ".webm"; } var name = imageName + ext; //SEND RESULTING RESPONSE TO 4CHANX FILES === QRSetFile var detail = { file: blob, name: name }; detail = cloneInto(detail, document.defaultView); document.dispatchEvent(new CustomEvent('QRSetFile', { bubbles: true, detail: detail })); if (text !== "" && text !== undefined) { text = this.createPostComment(text); this.setPropperLinking(text); } else { document.getElementById("add-post").click(); this.semaphore_posts++; } }; //4) CREATE POST QUEUE ThreadRebuilder.prototype.createPostComment = function (text) { var dummy = document.createElement("DIV"); dummy.innerHTML = text; var inside_node = dummy.firstChild; var return_text = ""; do { if (inside_node.tagName == "BR") return_text += "\n"; else return_text += inside_node.textContent; } while ((inside_node = inside_node.nextSibling)); return return_text; }; ; ThreadRebuilder.prototype.timeListenerFunction = function () { var time = parseInt(document.getElementById("qr-filename-container").nextSibling.value.replace(/[a-zA-Z]+/g, "")); if (time <= 5) { this.checked = false; } else if (time > 5) { this.checked = true; } }; ThreadRebuilder.prototype.killAll = function () { this.thread_data_length = 0; this.posts_created = 0; this.stopRoutine(); this.postID = undefined; this.semaphore = 1; this.semaphore_posts = 1; this.stopFillRoutine(); this.fillID = undefined; this.thread_data = [['Comment'], ['Image URLs'], ['Image Names'], ['Post No.']]; //CLEAR DUMP LIST var qr_dumplist = document.getElementById("dump-list").childNodes; var qr_dumplist_len = qr_dumplist.length; var current_preview = 0; while (qr_dumplist_len - current_preview > 1) { qr_dumplist[0].firstChild.click(); current_preview++; } }; return ThreadRebuilder; }(FeatureInterface)); var CharacterInserter = /** @class */ (function (_super) { __extends(CharacterInserter, _super); function CharacterInserter(use_kita, use_yen) { var _this = _super.call(this) || this; _this.kita_character = "キタ━━━(゚∀゚)━━━!!"; _this.kita_hash_color = "#444444"; _this.yen_character = "¥"; _this.yen_hash_color = "#9370DB"; _this.use_yen = use_yen; _this.use_kita = use_kita; _this.retrieveStates(); _this.init(); _this.activate(); return _this; } CharacterInserter.prototype.init = function () { this.addStyle(); this.hotkeyListeners(); }; CharacterInserter.prototype.activate = function () { console.log("4F-FSE: CharacterInserter Active - " + (this.use_kita ? "Character Coloring+" : "") + (this.use_yen ? " Line Coloring" : "")); }; CharacterInserter.prototype.decideAction = function (node) { if (node.tagName == "BLOCKQUOTE") this.colorCharacters(node); }; CharacterInserter.prototype.retrieveStates = function () { if (localStorage.getItem("Yen_Character") === undefined || localStorage.getItem("Yen_Character") === null) this.yen_character = "¥"; else this.yen_character = localStorage.getItem("Yen_Character"); if (localStorage.getItem("Yen_Color") === undefined || localStorage.getItem("Yen_Color") === null) this.yen_hash_color = "#9370DB"; else this.yen_hash_color = localStorage.getItem("Yen_Color"); if (localStorage.getItem("Kita_Character") === undefined || localStorage.getItem("Kita_Character") === null) this.kita_character = "キタ━━━(゚∀゚)━━━!!"; else this.kita_character = localStorage.getItem("Kita_Character"); if (localStorage.getItem("Kita_Color") === undefined || localStorage.getItem("Kita_Color") === null) this.kita_hash_color = "#444444"; else this.kita_hash_color = localStorage.getItem("Kita_Color"); }; CharacterInserter.prototype.storeStates = function () { var items = []; for (var _i = 0; _i < arguments.length; _i++) { items[_i] = arguments[_i]; } }; //color styling CharacterInserter.prototype.addStyle = function () { var style = document.createElement("STYLE"); style.innerHTML = ".the_m_word{color:" + this.yen_hash_color + "} \n.the_k_word{color:" + this.kita_hash_color + "}"; document.head.appendChild(style); }; //hotkeys for kita and yen CharacterInserter.prototype.hotkeyListeners = function () { var _this = this; var listener_obj = {}; window.addEventListener("keydown", function (e) { listener_obj[e.keyCode] = true; var node = document.activeElement; if ((listener_obj[17] || listener_obj[91]) && listener_obj[75]) { e.preventDefault(); _this.insertAtPos(node, _this.kita_character); } if ((listener_obj[17] || listener_obj[91]) && listener_obj[220]) { e.preventDefault(); _this.insertAtPos(node, _this.yen_character); } }, { passive: false, capture: false, once: false }); window.addEventListener("keyup", function (e) { listener_obj[e.keyCode] = false; }, { passive: false, capture: false, once: false }); }; CharacterInserter.prototype.insertAtPos = function (node, buzzwords) { var sel_start = node.selectionStart; var sel_end = node.selectionEnd; var node_text = node.value; node.value = node_text.substr(0, sel_start) + buzzwords + node_text.substr(sel_end); node.selectionStart = sel_start + buzzwords.length; node.selectionEnd = sel_end + buzzwords.length; }; //insertion logic CharacterInserter.prototype.colorCharacters = function (root) { if (root.nodeType !== Node.ELEMENT_NODE) { return; } if (root.textContent.indexOf(this.yen_character) <= -1 && root.textContent.indexOf(this.kita_character) <= -1) { return; } var wbr = root.getElementsByTagName('WBR'); var wbr_len = wbr.length; var wbr_indices = Array(); function previousIndex(len) { if (len > 0) return wbr_indices[len - 1]; else return 0; } for (var wbr_item = 0; wbr_item < wbr_len; wbr_item++) { wbr_indices.push(wbr[wbr_item].previousSibling.length + previousIndex(wbr_item)); } while (wbr.length) { root.removeChild(wbr[wbr.length - 1]); } root.normalize(); var txtItterator = document.createNodeIterator(root, NodeFilter.SHOW_TEXT); var text_node; while ((text_node = txtItterator.nextNode())) { //disregard text inside of A tag links and already colored text if (text_node.parentNode.tagName == "A" || /the_[a-z]_word/g.test(text_node.parentNode.className)) continue; this.setColor(text_node, txtItterator); } //restart and add back the wbr var txtItterator = document.createNodeIterator(root, NodeFilter.SHOW_TEXT); var text_node; while ((text_node = txtItterator.nextNode())) { //disregard text inside of A tag links and already colored text if (text_node.parentNode.tagName == "A") continue; wbr_indices = this.addWBR(text_node, txtItterator, wbr_indices); } }; //reinsert CharacterInserter.prototype.addWBR = function (text_node, txtItterator, wbr_indices) { wbr_indices[0] = wbr_indices[0] - text_node.length; if (wbr_indices[0] <= 0) { var split_node = text_node.splitText(text_node.length + wbr_indices[0]); var wbr = document.createElement("WBR"); split_node.parentNode.insertBefore(wbr, text_node.nextSibling); wbr_indices.shift(); } return wbr_indices; }; //give color to text inside of nodes. // first scan for yen symbols and then check the front of the text for not nested kita. CharacterInserter.prototype.setColor = function (text_node, txtItterator) { var start_text_node = text_node; var result; var yen_node = this.use_kita ? this.searchYen(text_node) : false; if (yen_node != false) { //jump to internal node text_node = txtItterator.nextNode(); //scan for nested kita do { result = this.use_kita ? this.searchKita(text_node) : false; if (result != false) { //jump foreward to point after kita inserted text_node = txtItterator.nextNode(); text_node = txtItterator.nextNode(); } } while (result != false); } //scan for outside kita from start do { result = this.use_kita ? this.searchKita(start_text_node) : false; start_text_node = result.nextSibling; } while (result != false && start_text_node !== undefined); }; //find the location of a yen, split the text from above that position, create a span element and place split into this span. //Then take the initial text node and insert into it from after the text node. CharacterInserter.prototype.searchYen = function (text_node) { var yenIndex = text_node.textContent.indexOf(this.yen_character); if (yenIndex > -1) { var splitNode = text_node.splitText(yenIndex); var span = document.createElement('span'); span.className = "the_m_word"; span.appendChild(splitNode); text_node.parentNode.insertBefore(span, text_node.nextSibling); return span; } return false; }; //find the location of a kita, isolate it by splitting from the point where the kita ends and the point where it begins. //Now that there are 3 text nodes, take the middle one from the start position index split, add the text which goes to the point of the rightmost split, //then refer back to the parent and place it after the leftmost string. CharacterInserter.prototype.searchKita = function (text_node) { var kIndex = text_node.textContent.indexOf(this.kita_character); if (kIndex > -1) { var far_split_note = text_node.splitText(kIndex + this.kita_character.length); var splitNode = text_node.splitText(kIndex); var span = document.createElement('span'); span.className = "the_k_word"; span.appendChild(splitNode); text_node.parentNode.insertBefore(span, text_node.nextSibling); return span; } return false; }; return CharacterInserter; }(FeatureInterface)); var PasswordViewer = /** @class */ (function (_super) { __extends(PasswordViewer, _super); function PasswordViewer() { var _this = _super.call(this) || this; _this.post_id = "postPassword"; _this.del_id = "delPassword"; _this.label_post = document.createElement('LABEL'); _this.label_del = document.createElement('LABEL'); _this.init(); _this.activate(); return _this; } PasswordViewer.prototype.init = function () { this.node_post = document.getElementById(this.post_id); this.node_del = document.getElementById(this.del_id); this.node_post_parent = this.node_post.parentNode; this.node_del_parent = this.node_del.parentNode; this.label_post.textContent = 'Post: '; this.label_del.textContent = 'Delete: '; }; //activate displays passwords PasswordViewer.prototype.activate = function () { console.log("4F-FSE: PasswordViewer Active"); this.node_post_parent.insertBefore(this.label_post, this.node_post); this.node_del_parent.insertBefore(this.label_del, this.node_del); this.node_post.removeAttribute('type'); this.node_del.removeAttribute('type'); document.getElementsByClassName('deleteform')[0].style.display = 'inline'; this.node_del.style.display = 'inline'; this.label_del.style.display = 'inline'; this.label_del.style.paddingLeft = '10px'; }; PasswordViewer.prototype.decideAction = function (node) { }; PasswordViewer.prototype.retrieveStates = function () { }; ; PasswordViewer.prototype.storeStates = function () { }; ; return PasswordViewer; }(FeatureInterface)); var SettingsWindow = /** @class */ (function (_super) { __extends(SettingsWindow, _super); function SettingsWindow() { var _this = _super.call(this) || this; _this.background_div = document.createElement('DIV'); _this.settings_div = document.createElement('DIV'); _this.close_div = document.createElement('DIV'); _this.contents_div = document.createElement('DIV'); _this.ul_selection_start = document.createElement('UL'); _this.close_link = document.createElement('A'); _this.title_para = document.createElement('P'); _this.title_text = document.createTextNode('4F-FSE Settings'); _this.end_para = document.createElement('P'); _this.end_text = document.createTextNode('Refresh to view changes'); _this.settings_style = document.createElement('STYLE'); //to change order change, this AND...* _this.list_items = [ { Text: " | View 『Image Hiding』 Settings", ListenerFunc: function (a_id) { _this.clearContainer(); _this.contents_div.innerHTML = "\n\t\t\t\t
\n\t\t\t\t\t\t\t\t \n\t\t\t\t\t\t\t\t \n\t\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\t \n\t\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\t \n\t\t\t\t\t\t\t\t
\n\t\t\t\t
\n\t\t\t\t"; document.getElementById("Expiration_Time").value = "" + (_this.setting_items.image_hiding_settings.Expiration_Time / Constants.MILLISECONDS_TO_THE_HOUR); document.getElementById("MD5_List_FSE").value = _this.setting_items.image_hiding_settings.MD5_List_FSE; var set_button = document.createElement('INPUT'); document.getElementById("disposable_container").appendChild(set_button); set_button.setAttribute('VALUE', "Set Image Settings"); set_button.addEventListener("click", function (evt) { _this.storeStates(); _this.clearContainer(); _this.rebuildContainer(); }); set_button.setAttribute('TYPE', 'button'); } }, { Text: " | View 『Word Replacement』 Settings", ListenerFunc: function (a_id) { _this.clearContainer(); var disposable_container = document.createElement("DIV"); disposable_container.setAttribute("ID", "disposable_container"); _this.contents_div.appendChild(disposable_container); _this.filterWindow(disposable_container); _this.filterSetTable(); } }, { Text: " | View 『Danbooru Image Adder』 Settings", ListenerFunc: function (a_id) { _this.clearContainer(); var disposable_container = document.createElement("DIV"); disposable_container.setAttribute("id", "disposable_container"); _this.contents_div.appendChild(disposable_container); disposable_container.innerHTML = "\n\t\t\t\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t
\n\t\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t
\n\t\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t
\n\t\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t
\n\t\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t
\n\t\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t
\n\t\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t
\t\n\t\t\n\t\t\t
\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\n\t\t\t
\n\t\t\n\t\t\t\n\t\t\t"; _this.setImageAdderFields(); _this.setImageAdderEventListeners(); } }, { Text: " | View 『Thread Rebuilder』 Settings", ListenerFunc: function (a_id) { _this.clearContainer(); var disposable_container = document.createElement("DIV"); disposable_container.setAttribute("id", "disposable_container"); _this.contents_div.appendChild(disposable_container); disposable_container.innerHTML = "\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t
\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t
\n\t\t\t\t\n\t\t\t"; (document.getElementById("setArchive")).addEventListener("click", function () { _this.storeStates(); _this.clearContainer(); _this.rebuildContainer(); }); if (_this.setting_items.thread_rebuild_settings.Archive_Type === "0") document.getElementById("OffsiteArchive").checked = true; else if (_this.setting_items.thread_rebuild_settings.Archive_Type === "1") document.getElementById("OnsiteArchive").checked = true; } }, { Text: " | View 『¥ Text』 Settings [Customizable]", ListenerFunc: function (a_id) { _this.clearContainer(); var disposable_container = document.createElement("DIV"); disposable_container.setAttribute("id", "disposable_container"); _this.contents_div.appendChild(disposable_container); disposable_container.innerHTML = "\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t
\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t
\n\t\t\t\t\n\t\t\t"; document.getElementById("SelectColorYen").addEventListener("input", function (evt) { document.getElementById("HexColorYen_text").value = (document.getElementById("SelectColorYen").value); }); document.getElementById("setQuote").addEventListener("click", function (e) { _this.storeStates(); _this.clearContainer(); _this.rebuildContainer(); }); if (_this.setting_items.character_inserter_settings.Yen_Character !== undefined) document.getElementById("quoteCharacter").value = _this.setting_items.character_inserter_settings.Yen_Character; if (_this.setting_items.character_inserter_settings.Yen_Color !== undefined) document.getElementById("HexColorYen_text").value = _this.setting_items.character_inserter_settings.Yen_Color; document.getElementById("SelectColorYen").value = _this.setting_items.character_inserter_settings.Yen_Color; } }, { Text: " | View 『Kita』 Settings [Customizable]", ListenerFunc: function (a_id) { _this.clearContainer(); var disposable_container = document.createElement("DIV"); disposable_container.setAttribute("id", "disposable_container"); _this.contents_div.appendChild(disposable_container); disposable_container.innerHTML = "\t\t\t\t\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t
\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t
\n\t\t\t\t\n\t\t\t"; document.getElementById("SelectColorKita").addEventListener("input", function (evt) { document.getElementById("HexColorKita_text").value = (document.getElementById("SelectColorKita").value); }); document.getElementById("setCharacter").addEventListener("click", function (e) { _this.storeStates(); _this.clearContainer(); _this.rebuildContainer(); }); if (_this.setting_items.character_inserter_settings.Kita_Character !== undefined) document.getElementById("selectiveCharacters").value = _this.setting_items.character_inserter_settings.Kita_Character; if (_this.setting_items.character_inserter_settings.Kita_Color !== undefined) document.getElementById("HexColorKita_text").value = _this.setting_items.character_inserter_settings.Kita_Color; document.getElementById("SelectColorKita").value = _this.setting_items.character_inserter_settings.Kita_Color; } }, { Text: " | Set 『Visible Password』", ListenerFunc: function (input_id) { _this.storeStates(); } }, ]; _this.setting_items = {}; _this.retrieveStates(); _this.init(); _this.activate(); return _this; } SettingsWindow.prototype.setImageAdderFields = function () { document.getElementById("width_DIA").value = this.setting_items.image_adder_settings.Width; document.getElementById("height_DIA").value = this.setting_items.image_adder_settings.Height; document.getElementById("qr_width_DIA").value = this.setting_items.image_adder_settings.QR_Width; if (document.getElementById("width_DIA").value == "489") document.getElementById("v_large_DIA").checked = true; else if (document.getElementById("width_DIA").value == "400") document.getElementById("large_DIA").checked = true; else if (document.getElementById("width_DIA").value == "300") document.getElementById("medium_DIA").checked = true; else if (document.getElementById("width_DIA").value == "200") document.getElementById("small_DIA").checked = true; }; SettingsWindow.prototype.setImageAdderEventListeners = function () { var _this = this; document.getElementById("v_large_DIA").addEventListener("click", function () { document.getElementById("width_DIA").value = "489"; document.getElementById("height_DIA").value = "489"; }); document.getElementById("large_DIA").addEventListener("click", function () { document.getElementById("width_DIA").value = "400"; document.getElementById("height_DIA").value = "400"; }); document.getElementById("medium_DIA").addEventListener("click", function () { document.getElementById("width_DIA").value = "300"; document.getElementById("height_DIA").value = "300"; }); document.getElementById("small_DIA").addEventListener("click", function () { document.getElementById("width_DIA").value = "200"; document.getElementById("height_DIA").value = "200"; }); document.getElementById("SetImageAdderProperties").addEventListener("click", function (evt) { _this.storeStates(); _this.clearContainer(); _this.rebuildContainer(); }); }; //*...THIS SettingsWindow.prototype.retrieveStates = function () { //values used to fill out data fields this.setting_items.image_hiding_settings = { Expiration_Time: localStorage.getItem("Expiration_Time"), MD5_List_FSE: localStorage.getItem("MD5_List_FSE"), Active: localStorage.getItem("ImageHidingActive") }; this.retrieveWordReplaceStates(); this.retrieveImageAdderStates(); this.retrieveRebuildStates(); this.retrieveCharacterInsertingStates(); this.setting_items.password_settings = (localStorage.getItem("PasswordActive")); }; SettingsWindow.prototype.retrieveActiveToggles = function () { if (localStorage.getItem("4F-FSE") === null) { document.getElementById("check-settings0").checked = true; document.getElementById("check-settings1").checked = false; document.getElementById("check-settings2").checked = false; document.getElementById("check-settings3").checked = false; document.getElementById("check-settings4").checked = true; document.getElementById("check-settings5").checked = true; document.getElementById("check-settings6").checked = true; localStorage.setItem("4F-FSE", "Success"); this.displayWindow(); return; } document.getElementById("check-settings0").checked = localStorage.getItem("ImageHidingActive") === 'true'; document.getElementById("check-settings1").checked = localStorage.getItem("TextReplaceActive") === 'true'; document.getElementById("check-settings2").checked = localStorage.getItem("ImageAdderActive") === 'true'; document.getElementById("check-settings3").checked = localStorage.getItem("ThreadRebuilderActive") === 'true'; document.getElementById("check-settings4").checked = localStorage.getItem("YenActive") === 'true'; document.getElementById("check-settings5").checked = localStorage.getItem("KitaActive") === 'true'; document.getElementById("check-settings6").checked = localStorage.getItem("PasswordActive") === 'true'; }; SettingsWindow.prototype.retrieveWordReplaceStates = function () { //acquire text filter representation var storage_index = 0; var JSON_storage = {}; var storage_key; var text_filters = []; var local_store_len = window.localStorage.length; while (storage_index < local_store_len) { storage_key = window.localStorage.key(storage_index); JSON_storage[storage_key] = window.localStorage.getItem(storage_key); storage_index++; } var filters = Generics.getJSONPropertiesByKeyName(JSON_storage, "[0-9]+FLT"); filters.sort(); filters.forEach(function (filter) { text_filters.push(TextReplacer.formatFilterSettings(JSON_storage[filter])); }); this.setting_items.word_replace_settings = { Number_of_Filters: localStorage.getItem("filter_quantity"), Text_Filter_List: text_filters, Active: localStorage.getItem("TextReplaceActive") }; }; SettingsWindow.prototype.retrieveImageAdderStates = function () { this.setting_items.image_adder_settings = { Width: localStorage.getItem("width_DIA"), Height: localStorage.getItem("height_DIA"), QR_Width: localStorage.getItem("qr_width_DIA"), Active: localStorage.getItem("ImageAdderActive") }; if (this.setting_items.image_adder_settings.Height === null) this.setting_items.image_adder_settings.Height = 400; if (this.setting_items.image_adder_settings.Width === null) this.setting_items.image_adder_settings.Width = 400; if (this.setting_items.image_adder_settings.QR_Width === null) this.setting_items.image_adder_settings.QR_Width = 480; document.getElementById("fourchanx-css").textContent += ".qr-preview { height:" + this.setting_items.image_adder_settings.Height + "px; width: " + this.setting_items.image_adder_settings.Width + "px; left:8%;background-size: cover;}"; document.getElementById("fourchanx-css").textContent += "#dump-list { min-height: " + (this.setting_items.image_adder_settings.Width - 20) + "px; width: " + (this.setting_items.image_adder_settings.QR_Width) + "px;}"; }; SettingsWindow.prototype.retrieveRebuildStates = function () { if (localStorage.getItem("ArchiveType_FSE") !== "1" && localStorage.getItem("ArchiveType_FSE") !== "0") localStorage.setItem("ArchiveType_FSE", "1"); this.setting_items.thread_rebuild_settings = { Archive_Type: localStorage.getItem("ArchiveType_FSE"), Active: localStorage.getItem("ThreadRebuilderActive") }; }; SettingsWindow.prototype.retrieveCharacterInsertingStates = function () { if (localStorage.getItem("Yen_Character") === undefined || localStorage.getItem("Yen_Character") === null) localStorage.setItem("Yen_Character", "¥"); if (localStorage.getItem("Yen_Color") === undefined || localStorage.getItem("Yen_Color") === null) localStorage.setItem("Yen_Color", "#9370DB"); if (localStorage.getItem("Kita_Character") === undefined || localStorage.getItem("Kita_Character") === null) localStorage.setItem("Kita_Character", "キタ━━━(゚∀゚)━━━!!"); if (localStorage.getItem("Kita_Color") === undefined || localStorage.getItem("Kita_Color") === null) localStorage.setItem("Kita_Color", "#444444"); this.setting_items.character_inserter_settings = { Yen_Active: localStorage.getItem("YenActive"), Yen_Character: localStorage.getItem("Yen_Character"), Yen_Color: localStorage.getItem("Yen_Color"), Kita_Active: localStorage.getItem("KitaActive"), Kita_Character: localStorage.getItem("Kita_Character"), Kita_Color: localStorage.getItem("Kita_Color") }; }; SettingsWindow.prototype.storeStates = function () { //image settings this.storeImageFilterStates(); //Text replace settings this.storeTextFilterStates(); //Image Adder settings this.storeImageAdderStates(); //Thread rebuild settings this.storeRebuildStates(); //character inserter this.storeCharacterInserterStates(); //Password replace settings this.storePasswordStates(); this.retrieveStates(); }; SettingsWindow.prototype.storeActiveToggles = function () { localStorage.setItem("ImageHidingActive", (document.getElementById("check-settings0").checked.toString())); localStorage.setItem("TextReplaceActive", (document.getElementById("check-settings1").checked.toString())); localStorage.setItem("ImageAdderActive", (document.getElementById("check-settings2").checked.toString())); localStorage.setItem("ThreadRebuilderActive", (document.getElementById("check-settings3").checked.toString())); localStorage.setItem("YenActive", (document.getElementById("check-settings4").checked.toString())); localStorage.setItem("KitaActive", (document.getElementById("check-settings5").checked.toString())); localStorage.setItem("PasswordActive", (document.getElementById("check-settings6").checked.toString())); }; SettingsWindow.prototype.storeImageFilterStates = function () { if (document.getElementById("Expiration_Time") !== null) { var time = document.getElementById("Expiration_Time"); var millisecond_time = parseInt(time.value) * Constants.MILLISECONDS_TO_THE_HOUR; if (millisecond_time == 0 || millisecond_time === null || millisecond_time === undefined) millisecond_time = Constants.DEFAULT_HIDE_EXPIRATION_TIME; localStorage.setItem("Expiration_Time", millisecond_time.toString()); var md5_filters = document.getElementById("MD5_List_FSE").value; localStorage.setItem("MD5_List_FSE", md5_filters); Generics.alert4ChanX("Image Settings Saved", "success", 3); } }; SettingsWindow.prototype.storeTextFilterStates = function () { if (document.getElementById("FilterRow0") !== null) { var f_row_moving = document.getElementById("FilterRow0"); var Number_of_Filters = 0; var Number_of_Filters_actual = 0; while (f_row_moving.nextSibling !== null) { if (document.getElementById("Pattern" + Number_of_Filters).value !== "") Number_of_Filters_actual++; Number_of_Filters++; f_row_moving = f_row_moving.nextSibling; } window.localStorage.setItem("filter_quantity", Number_of_Filters_actual.toString()); for (var pattern_input = 0; pattern_input < Number_of_Filters; pattern_input++) { var pattern_to_store = document.getElementById("Pattern" + pattern_input).value; var replacement_to_store = document.getElementById("Replacement" + pattern_input).value; var setting = 'g'; try { if (pattern_to_store === "") { localStorage.removeItem(pattern_input + "FLT"); continue; } else if (new RegExp("^\/.*\/\\D+$").test(pattern_to_store)) { } else if (new RegExp("^\/.*\/$").test(pattern_to_store)) { pattern_to_store = pattern_to_store + setting; } else if (!new RegExp("^/.*\/\\D$").test(pattern_to_store)) { pattern_to_store = "/" + pattern_to_store + "/" + setting; } //test for breakages, try to cause error var error_test = new RegExp(pattern_to_store.substring(0, pattern_to_store.lastIndexOf("/") + 1), pattern_to_store.substring(pattern_to_store.lastIndexOf("/") + 1)); } catch (e) { Generics.alert4ChanX("Unrecoverable Regex error on pattern " + pattern_input + " for " + pattern_to_store, "error", undefined); continue; } pattern_to_store = encodeURIComponent(pattern_to_store); var save_string = document.getElementById("Active" + pattern_input).checked + '=' + pattern_to_store + '=' + replacement_to_store; window.localStorage.setItem(pattern_input + "FLT", save_string); } Generics.alert4ChanX("Wordfilters Updated!", "success", 3); } }; SettingsWindow.prototype.storeImageAdderStates = function () { if (document.getElementById("SetImageAdderProperties") !== null) { var width = document.getElementById("width_DIA").value; localStorage.setItem("width_DIA", width); var height = document.getElementById("height_DIA").value; localStorage.setItem("height_DIA", height); var qr_width = document.getElementById("qr_width_DIA").value; localStorage.setItem("qr_width_DIA", qr_width); } }; SettingsWindow.prototype.storeRebuildStates = function () { if (document.getElementById("setArchive") !== null) { localStorage.setItem("ArchiveType_FSE", document.getElementById("OffsiteArchive").checked === true ? "0" : "1"); } }; SettingsWindow.prototype.storeCharacterInserterStates = function () { if (document.getElementById("setCharacter") !== null) { localStorage.setItem("Kita_Character", document.getElementById("selectiveCharacters").value); localStorage.setItem("Kita_Color", document.getElementById("HexColorKita_text").value); } else if (document.getElementById("setQuote") !== null) { localStorage.setItem("Yen_Character", document.getElementById("quoteCharacter").value); localStorage.setItem("Yen_Color", document.getElementById("HexColorYen_text").value); } }; SettingsWindow.prototype.storePasswordStates = function () { //password view settings if (document.getElementById("check-settings6") !== null) localStorage.setItem("PasswordActive", "" + document.getElementById("check-settings6").checked); }; SettingsWindow.prototype.clearContainer = function () { var disposable = document.getElementById("disposable_container"); if (disposable !== null) this.contents_div.removeChild(disposable); else this.contents_div.removeChild(this.ul_selection_start); }; SettingsWindow.prototype.rebuildContainer = function () { this.contents_div.appendChild(this.ul_selection_start); }; SettingsWindow.prototype.init = function () { var _this = this; this.settings_style.innerHTML = ".inputs{\n\t\t\t\t\t\t\t\t\t\t\tbackground-color:rgb(200,200,200);margin:5px 7px;width:100px;\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t.SettingsBackground{\n\t\t\t\t\t\t\t\t\t\t\tposition:fixed;width:100%;height:100%;background-color:rgba(200,200,200,0.3);top:0;left:0; z-index:9\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t.settingsItem{\n\t\t\t\t\t\t\t\t\t\t\tfont-size:18px;list-style:katakana-iroha outside;padding:2px;color:#2e2345;\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t.settingsItem input{\n\t\t\t\t\t\t\t\t\t\t\ttransform: scale(1.2);\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t.settingsMain{\n\t\t\t\t\t\t\t\t\t\t\tborder:solid 1px black;position:fixed;background-color:rgb(200,200,200);left:40%;top:20%;margin-bottom:0; z-index:10\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t.closeIcon{\n\t\t\t\t\t\t\t\t\t\t\tborder:solid 1px black;position:absolute;width:25px;height:25px;background-color:rgba(255,100,90,0.9); right:3px;top:3px; z-index:10\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t.titleStyle{\n\t\t\t\t\t\t\t\t\t\t\tfont-size: 20px;padding: 12px 0px 9px 22px\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t.tooltip-4F{\n\t\t\t\t\t\t\t\t\t\t\tz-index:9;padding:5px;border:1px solid black;background-color:white;word-wrap:break-word;display:none;position:absolute;\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t.help_icon{\n\t\t\t\t\t\t\t\t\t\t\theight:22.5px;margin:-4px 10px\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t.footerStyle{\n\t\t\t\t\t\t\t\t\t\t\tpadding-left: 12px;\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t.contentStyle{\n\t\t\t\t\t\t\t\t\t\t\tbackground-color:white;margin:0 0;padding:5px 25px;\n\t\t\t\t\t\t\t\t\t\t}"; this.background_div.setAttribute('class', 'SettingsBackground'); this.background_div.setAttribute('id', 'SettingsBackground'); this.background_div.setAttribute('style', 'display:none'); this.settings_div.setAttribute('class', 'settingsMain'); this.settings_div.setAttribute('id', 'settingsWindow'); this.settings_div.setAttribute('style', 'display:none;width:500px'); this.close_link.setAttribute('href', 'javascript:void(0)'); this.close_div.setAttribute('class', 'closeIcon'); this.close_div.addEventListener('click', function (evt) { return _this.hideWindow(); }); this.title_para.setAttribute('class', 'titleStyle'); this.contents_div.setAttribute('class', 'contentStyle'); this.end_para.setAttribute('class', 'footerStyle'); this.ul_selection_start.setAttribute("ID", "selection_list"); this.generateList(this.contents_div); }; SettingsWindow.prototype.generateList = function (head_node) { var _this = this; this.list_items.forEach(function (list_item, index) { var li = document.createElement('LI'); li.setAttribute('class', 'settingsItem'); if (list_item.Text.indexOf('View') > -1) { var input = document.createElement('INPUT'); var input_id = 'check-settings' + index; input.setAttribute('TYPE', 'checkbox'); input.setAttribute('ID', 'check-settings' + index); li.appendChild(input); input.addEventListener('click', function (evt) { return _this.storeActiveToggles(); }); var a = document.createElement('A'); a.setAttribute('href', 'javascript:void(0)'); a.textContent = list_item.Text; var a_id = 'tab-settings' + index; a.setAttribute('ID', 'tab-settings' + index); var setup_func = function (_a_id) { a.addEventListener('click', function (evt) { return list_item.ListenerFunc(_a_id); }); li.appendChild(a); _this.ul_selection_start.appendChild(li); }; setup_func(a_id); } else { var input = document.createElement('INPUT'); var input_id = 'check-settings' + index; input.setAttribute('TYPE', 'checkbox'); input.setAttribute('ID', 'check-settings' + index); input.addEventListener('click', function (evt) { return _this.storeActiveToggles(); }); var label = document.createElement('LABEL'); label.appendChild(input); var label_text = document.createTextNode(list_item.Text); label.appendChild(label_text); li.appendChild(label); _this.ul_selection_start.appendChild(li); input.checked = _this.setting_items.password_settings == 'true'; var setup_func = function (input_id) { label.addEventListener('click', function (evt) { return list_item.ListenerFunc(input_id); }); }; setup_func(input_id); } }); }; SettingsWindow.prototype.activate = function () { var _this = this; document.body.appendChild(this.settings_style); this.background_div.addEventListener('click', function (evt) { return _this.hideWindow(); }); document.body.appendChild(this.background_div); this.settings_div.appendChild(this.close_link); this.close_link.appendChild(this.close_div); this.title_para.appendChild(this.title_text); this.settings_div.appendChild(this.title_para); this.settings_div.appendChild(this.contents_div); this.contents_div.appendChild(this.ul_selection_start); this.end_para.appendChild(this.end_text); this.settings_div.appendChild(this.end_para); document.body.appendChild(this.settings_div); this.retrieveActiveToggles(); }; SettingsWindow.prototype.decideAction = function (node) { }; SettingsWindow.prototype.getSettingsArr = function () { return this.setting_items; }; SettingsWindow.prototype.displayWindow = function () { this.background_div.style.display = 'block'; this.settings_div.style.display = 'block'; this.rebuildContainer(); }; SettingsWindow.prototype.hideWindow = function () { this.background_div.style.display = 'none'; this.settings_div.style.display = 'none'; this.clearContainer(); }; SettingsWindow.prototype.filterWindow = function (disposable_container) { var _this = this; var filter_table = document.createElement("table"); filter_table.setAttribute("style", "text-align:center;"); filter_table.setAttribute("id", "filter_table"); disposable_container.appendChild(filter_table); var top_row = document.createElement("TR"); filter_table.appendChild(top_row); var table_head_active = document.createElement("th"); top_row.appendChild(table_head_active); var head_text_active = document.createTextNode("Active"); table_head_active.appendChild(head_text_active); var table_head_pattern = document.createElement("th"); top_row.appendChild(table_head_pattern); var headTextPattern = document.createTextNode("Pattern"); table_head_pattern.appendChild(headTextPattern); var table_head_replacement = document.createElement("th"); top_row.appendChild(table_head_replacement); var head_text_replacement = document.createTextNode("Replacement"); table_head_replacement.appendChild(head_text_replacement); //Create the pattern table //loop to create rows var Number_of_Filters = parseInt(this.setting_items.word_replace_settings.Number_of_Filters); console.log(Number_of_Filters); if (Number_of_Filters === 0 || isNaN(Number_of_Filters)) Number_of_Filters = 6; for (var i = 0; i < Number_of_Filters; i++) { var table_row_contents = document.createElement("tr"); table_row_contents.setAttribute("id", "FilterRow" + i); var table_data_active = document.createElement("td"); var table_checkbox_active = document.createElement("input"); table_checkbox_active.setAttribute("type", "checkbox"); table_checkbox_active.setAttribute("id", "Active" + i); table_data_active.appendChild(table_checkbox_active); table_row_contents.appendChild(table_data_active); var table_data_pattern = document.createElement("td"); var table_input_pattern = document.createElement("input"); table_input_pattern.setAttribute("class", "inputs"); table_input_pattern.setAttribute("id", "Pattern" + i); table_data_pattern.appendChild(table_input_pattern); table_row_contents.appendChild(table_data_pattern); var table_data_replacement = document.createElement("td"); var table_input_replacement = document.createElement("input"); table_input_replacement.setAttribute("class", "inputs"); table_input_replacement.setAttribute("id", "Replacement" + i); table_data_replacement.appendChild(table_input_replacement); table_row_contents.appendChild(table_data_replacement); filter_table.appendChild(table_row_contents); } var table_last_contents = document.createElement("tr"); var table_add_collumn = document.createElement("td"); var table_add_row_button = document.createElement("input"); var table_subtract_row_button = document.createElement("input"); table_subtract_row_button.setAttribute("type", "button"); table_subtract_row_button.setAttribute("value", "-"); table_subtract_row_button.setAttribute("style", "padding: 7px 0; margin:5px 0;"); table_add_collumn.appendChild(table_subtract_row_button); table_subtract_row_button.addEventListener("click", function (evt) { return _this.filterRemoveRow(); }); table_add_row_button.setAttribute("type", "button"); table_add_row_button.setAttribute("value", "+"); table_add_row_button.setAttribute("style", "padding: 7px 0; margin:5px 0;"); table_add_collumn.appendChild(table_add_row_button); table_add_row_button.addEventListener("click", function (evt) { return _this.filterAddRow(); }); table_last_contents.appendChild(table_add_collumn); var table_set_collumn = document.createElement("td"); var table_confirm_button = document.createElement("input"); table_confirm_button.setAttribute("type", "button"); table_confirm_button.setAttribute("id", "table_confirm_button"); table_confirm_button.setAttribute("value", "Set Replacements"); table_confirm_button.setAttribute("style", "padding: 7px 0; margin:5px 0;"); //event listeners table_confirm_button.addEventListener("click", function (evt) { _this.storeStates(); _this.clearContainer(); _this.rebuildContainer(); }); table_set_collumn.appendChild(table_confirm_button); table_last_contents.appendChild(table_set_collumn); var table_close_collumn = document.createElement("td"); var table_close_button = document.createElement("input"); table_close_button.setAttribute("type", "button"); table_close_button.setAttribute("value", "Close Without Saving"); table_close_button.setAttribute("style", "padding: 7px 0; margin:5px 0;"); table_close_button.addEventListener("click", function (evt) { _this.clearContainer(); _this.rebuildContainer(); }); table_close_collumn.appendChild(table_close_button); table_last_contents.appendChild(table_close_collumn); filter_table.appendChild(table_last_contents); }; SettingsWindow.prototype.filterAddRow = function () { var _this = this; var filter_table = document.getElementById("filter_table"); var Number_of_Filters = 0; var filter_children = document.getElementById("filter_table").firstChild; while (filter_children.nextSibling) { filter_children = filter_children.nextSibling; Number_of_Filters++; } var table_row_contents = document.createElement("tr"); table_row_contents.setAttribute("id", "FilterRow" + (Number_of_Filters - 1)); filter_table.removeChild(filter_children); var table_data_active = document.createElement("td"); var table_checkbox_active = document.createElement("input"); table_checkbox_active.setAttribute("type", "checkbox"); table_checkbox_active.setAttribute("id", "Active" + (Number_of_Filters - 1)); table_data_active.appendChild(table_checkbox_active); table_row_contents.appendChild(table_data_active); var table_data_pattern = document.createElement("td"); var table_input_pattern = document.createElement("input"); table_input_pattern.setAttribute("class", "inputs"); table_input_pattern.setAttribute("id", "Pattern" + (Number_of_Filters - 1)); table_data_pattern.appendChild(table_input_pattern); table_row_contents.appendChild(table_data_pattern); var table_data_replacement = document.createElement("td"); var table_input_replacement = document.createElement("input"); table_input_replacement.setAttribute("class", "inputs"); table_input_replacement.setAttribute("id", "Replacement" + (Number_of_Filters - 1)); table_data_replacement.appendChild(table_input_replacement); table_row_contents.appendChild(table_data_replacement); filter_table.appendChild(table_row_contents); var table_last_contents = document.createElement("tr"); var table_add_collumn = document.createElement("td"); var table_add_row_button = document.createElement("input"); var table_subtract_row_button = document.createElement("input"); table_subtract_row_button.setAttribute("type", "button"); table_subtract_row_button.setAttribute("value", "-"); table_subtract_row_button.setAttribute("style", "padding: 7px 0; margin:5px 0;"); table_add_collumn.appendChild(table_subtract_row_button); table_subtract_row_button.addEventListener("click", function (evt) { return _this.filterRemoveRow(); }); table_add_row_button.setAttribute("type", "button"); table_add_row_button.setAttribute("value", "+"); table_add_row_button.setAttribute("style", "padding: 7px 0; margin:5px 0;"); table_add_collumn.appendChild(table_add_row_button); table_add_row_button.addEventListener("click", function (evt) { return _this.filterAddRow(); }); table_last_contents.appendChild(table_add_collumn); var table_set_collumn = document.createElement("td"); var table_confirm_button = document.createElement("input"); table_confirm_button.setAttribute("type", "button"); table_confirm_button.setAttribute("id", "table_confirm_button"); table_confirm_button.setAttribute("value", "Set Replacements"); table_confirm_button.setAttribute("style", "padding: 7px 0; margin:5px 0;"); //event listeners table_confirm_button.addEventListener("click", function (evt) { _this.storeStates(); _this.clearContainer(); _this.rebuildContainer(); }); table_set_collumn.appendChild(table_confirm_button); table_last_contents.appendChild(table_set_collumn); var table_close_collumn = document.createElement("td"); var table_close_button = document.createElement("input"); table_close_button.setAttribute("type", "button"); table_close_button.setAttribute("value", "Close Without Saving"); table_close_button.setAttribute("style", "padding: 7px 0; margin:5px 0;"); table_close_button.addEventListener("click", function (evt) { _this.clearContainer(); _this.rebuildContainer(); }); table_close_collumn.appendChild(table_close_button); table_last_contents.appendChild(table_close_collumn); filter_table.appendChild(table_last_contents); }; SettingsWindow.prototype.filterRemoveRow = function () { var filter_table = document.getElementById("filter_table"); var Number_of_Filters = 0; var filter_children = document.getElementById("filter_table").firstChild; while (filter_children.nextSibling) { filter_children = filter_children.nextSibling; Number_of_Filters++; } if (Number_of_Filters != 2) { filter_table.deleteRow(--Number_of_Filters); } }; SettingsWindow.prototype.filterSetTable = function () { var filter_length = this.setting_items.word_replace_settings.Number_of_Filters; for (var filter_count = 0; filter_count < filter_length; filter_count++) { if (this.setting_items.word_replace_settings.Text_Filter_List[filter_count].Active === null || this.setting_items.word_replace_settings.Text_Filter_List[filter_count].Regex === null || this.setting_items.word_replace_settings.Text_Filter_List[filter_count].Replacement === null) return; if (this.setting_items.word_replace_settings.Text_Filter_List[filter_count].Active === "true") { document.getElementById("Active" + filter_count).checked = true; } else { document.getElementById("Active" + filter_count).checked = false; } document.getElementById("Pattern" + filter_count).value = this.setting_items.word_replace_settings.Text_Filter_List[filter_count].Regex; document.getElementById("Replacement" + filter_count).value = this.setting_items.word_replace_settings.Text_Filter_List[filter_count].Replacement; } }; return SettingsWindow; }(FeatureInterface)); var Main = /** @class */ (function (_super) { __extends(Main, _super); function Main() { var _this = _super.call(this) || this; _this.features = {}; /*;any bypasses dot notation issues on objects*/ _this.settings = {}; if (!Generics.storageAvailable('localStorage')) { alert("4F-FSE: local storage error"); return _this; } else _this.activate(); _this.retrieveStates(); _this.init(); _this.decideAction(document.getElementById('delform')); _this.observeEvents(); return _this; } Main.prototype.retrieveStates = function () { var top_bar = new TopBar(); top_bar.build(); this.settings = top_bar.getSettingsArr(); }; Main.prototype.init = function () { if (this.settings.image_hiding_settings.Active === "true") { this.features.image_hider = new ImageHider(); } if (this.settings.word_replace_settings.Active === "true") { this.features.text_replacer = new TextReplacer(); } if (this.settings.image_adder_settings.Active === "true") { this.features.danbooru_image_adder = new DanbooruImageAdder(); } if (this.settings.thread_rebuild_settings.Active === "true") { this.features.thread_rebuilder = new ThreadRebuilder(); } if (this.settings.character_inserter_settings.Yen_Active === "true" || this.settings.character_inserter_settings.Kita_Active === "true") { this.features.character_inserter = new CharacterInserter(this.settings.character_inserter_settings.Yen_Active === "true", this.settings.character_inserter_settings.Kita_Active === "true"); } if (this.settings.password_settings == 'true') { this.features.password_viewer = new PasswordViewer(); } for (var feature_key in this.features) this.features[feature_key].retrieveStates(); }; Main.prototype.activate = function () { console.log("4F-FSE Starting"); }; Main.prototype.storeStates = function () { }; Main.prototype.observeEvents = function () { var _this = this; var document_changes = new MutationObserver(function (mutations) { mutations.forEach(function (mutation) { [].forEach.call(mutation.addedNodes, function (node) { return _this.decideAction(node); }); }); }).observe(document.body, { childList: true, subtree: true }); }; Main.prototype.decideAction = function (node) { if (node === undefined || node.tagName === undefined) return; var start = node; var itterator = document.createNodeIterator(start, NodeFilter.SHOW_ELEMENT); var node; while ((node = itterator.nextNode())) { if (node.tagName !== "BLOCKQUOTE" && node.tagName !== "IMG" && node.tagName !== "VIDEO") continue; for (var feature_key in this.features) { this.features[feature_key].decideAction(node); } } }; return Main; }(FeatureInterface)); document.addEventListener('4chanXInitFinished', function () { new Main(); });