Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- modules['selfPostFilter'] = {
- moduleID: 'selfPostFilter',
- moduleName: 'Self Post Filter',
- options: {
- //
- },
- description: 'Self-post filter',
- isEnabled: function() {
- return RESConsole.getModulePrefs(this.moduleID);
- },
- include: Array(
- /reddit.com/i
- ),
- exclude: new Array(
- /^https?:\/\/www\.reddit\.com\/prefs\//i,
- /^https?:\/\/www\.reddit\.com\/message\//i,
- /^https?:\/\/www\.reddit\.com\/user\//i
- ),
- isMatchURL: function() {
- return RESUtils.isMatchURL(this.moduleID);
- },
- go: function() {
- if ((this.isEnabled()) && (this.isMatchURL())) {
- var parentDiv = document.querySelectorAll('div.sidebox.submit div.morelink')[0];
- var dv = document.createElement("div");
- dv.setAttribute("id", "selfPostDiv");
- dv.innerHTML = "<p><input type='checkbox' defaultChecked='false' id='selfCB'> Self Post Filter ON/OFF</p><br/>";
- parentDiv.parentNode.insertBefore(dv, parentDiv);
- document.getElementById('selfCB').addEventListener('click', function() {
- if (selfCB.checked == false) {
- var i = document.querySelectorAll('div.thing.link');
- for (var x = 0,leni=i.length; x <= leni-1; x++) {
- i[x].setAttribute('style', 'display:block');
- }
- } else {
- var i = document.querySelectorAll('div.thing.link:not(.self)');
- for (var j = 0,lenj=i.length; j <= lenj-1; j++) {
- i[j].setAttribute('style', 'display:none');
- }
- }
- });
- }
- }
- };
Add Comment
Please, Sign In to add comment