// ==UserScript== // @name Forum Extract // @namespace / // @description Filters out any unwanted listings on forum.userstyles.org // @author Sonny Razzano // @version 3.0.1 // @include http://forum.userstyles.org/* // ==/UserScript== testGM(); function testGM() { const STORAGE_PREFIX = 'ustoe-'; isGM = typeof GM_getValue != 'undefined' && typeof GM_getValue('a', 'b') != 'undefined'; addStyle = isGM ? GM_addStyle : function(css) {var head = $('head')[0]; if(!head) return; var style = $c('style', {type:'text/css',innerHTML:css}); head.appendChild(style)} setValue = isGM ? GM_setValue : function(name,value) {switch (typeof(value)) {case 'string': localStorage.setItem(STORAGE_PREFIX+name,'S]' + value); break; case 'number': if(value.toString().indexOf('.') < 0) {localStorage.setItem(STORAGE_PREFIX + name, 'N]' + value)} break; case 'boolean': localStorage.setItem(STORAGE_PREFIX+name, 'B]' + value); break}} getValue = isGM ? GM_getValue : function(name,defValue) {var value = localStorage.getItem(STORAGE_PREFIX + name); if(value == null) {return defValue} else {switch(value.substr(0,2)) {case 'S]': return value.substr(2); case 'N]': return parseInt(value.substr(2)); case 'B]': return value.substr(2) == 'true';}} return value} deleteValue = isGM ? GM_deleteValue : function(name) {localStorage.removeItem(STORAGE_PREFIX+name)} jParse = (window.JSON && window.JSON.parse) ? window.JSON.parse : eval; jStringify = (window.JSON && window.JSON.stringify) ? window.JSON.stringify : uneval; } function $(q, root, single, context) { root = root || document; context = context || root; if(q[0] == '#') return root.getElementById(q.substr(1)); if(q.match(/^[\/*]|^\.[\/\.]/)) { if(single) return root.evaluate(q, context, null, 9, null).singleNodeValue; var arr = []; var xpr = root.evaluate(q, context, null, 7, null); for(var i = 0; i < xpr.snapshotLength; i++) arr.push(xpr.snapshotItem(i)); return arr; } if(q[0] == '.') { if(single) return root.getElementsByClassName(q.substr(1))[0]; return root.getElementsByClassName(q.substr(1)); } if(single) return root.getElementsByTagName(q)[0]; return root.getElementsByTagName(q); } function $c(type, props, evls) { var node = document.createElement(type); if(props && typeof props == 'object') { for(prop in props) { if(typeof node[prop] == 'undefined') node.setAttribute(prop, props[prop]); else node[prop] = props[prop]; } } if(evls instanceof Array) { for(var i = 0; i < evls.length; i++) { var evl = evls[i]; if(typeof evl.type == 'string' && typeof evl.fn == 'function') node.addEventListener(evl.type, evl.fn, false); } } return node; } String.prototype.trim = function() { return this.replace(/^\s+|\s+$/g, ''); } // CSS Forum ========================================================================== addStyle('\ #Body{margin:64px 0 0 0!important}\ div.Menu{height:58px!important;margin:0 10px!important;width:100%!important}\ #Head{position:fixed!important;top:0!important;width:100%!important;z-index:999!important}\ #Head .Search,#Head #Search{bottom:3px!important;height:52px!important;right:20px!important;width:336px!important}\ ul#Menu{left:0!important;margin:0!important;position:absolute!important;top:30px!important}\ body #Head h1{padding:5px 0 0 0!important}\ #Menu li{line-height:23px!important;margin-top:5px!important}\ #Menu li.NonTab a[href*="/signin?"]{-moz-border-radius:4px 4px 0 0!important;background:-moz-linear-gradient(#2E89B7,#FFF,#FFF)!important;color:#1E79A7!important;font-weight:bold!important;text-shadow:2px 2px 2px #999!important}\ #Menu a{height:23px!important}\ #Head form{-moz-border-radius:2px 3px 3px 2px!important;background:transparent!important;height:27px!important;margin-top:0!important;width:auto!important}\ #Head form div{height:24px!important}\ #Head form div *{vertical-align:top!important;}\ #Head form input.InputBox{-moz-border-radius:0!important;border:none!important;color:#1E79A8!important;font-family:tahoma,sans-serif!important;font-weight:bold!important;height:24px!important;margin:0!important;padding:0!important;text-align:left!important;width:179px}\ #Content,#Panel{margin:0 1% 1% 1%!important}\ #Content{position:absolute!important;width:76%!important}\ #Panel{position:fixed!important;width:21%!important;}\ div.Tabs:not(.FirstPage){text-align:center!important}\ div.Tabs div.SubTab{background-color:transparent!important;color:#000!important;margin:4px!important}\ div.Tabs li a{padding:4px 2px!important}\ div.Tabs li.Active{margin:0 2px!important}\ div.Tabs li.Active a{-moz-box-shadow:0 0 2px #000 inset,2px 2px 4px #000!important;-moz-border-radius:3px!important;background:#FFF!important;border: 1px solid #ABDAFB!important;color:#474747!important;font-weight:bold!important;padding:4px!important;text-shadow:2px 2px 2px #999}\ div.Tabs li:not(.Active) .TabLink:hover{background:#E3F4FF!important}\ div.FirstPage+div.Tabs{padding:0 4px 4px 4px!important;text-align:left!important}\ #Panel li.Active{-moz-border-radius:3px!important;-moz-box-shadow:0 0 4px #000 inset,2px 2px 4px #000!important;border: 1px solid #ABDAFB!important;text-shadow:2px 2px 2px #999!important;position:relative;z-index:1}\ #Panel li.Active a{color:#222!important}\ div.Tabs li.Active span,div.Tabs li:hover span{color:#FFF!important}\ div.Tabs.HeadingTabs.DiscussionTabs{background:#CFECFF!important}\ body.Discussion a.Bookmark{margin:9px!important}\ body.Discussions #Content,body.Conversations #Content,body.Discussion #Content,body.Conversation #Content{left:0!important;width:76%!important}\ body.Discussions #Panel,body.Conversations #Panel,body.Discussion #Panel,body.Conversation #Panel{right:0!important;width:21%!important}\ body.Profile #Content{right:0!important;width:70%!important}\ body.Profile #Panel{left:0!important}\ body.Drafts #Panel{right:0!important}\ ul.DataList.Discussions.Mine{margin-bottom:20px!important}\ ul.Activities ul.DataList{width:94%!important}\ ul.DataList div.Options{width: 30px !important}\ ul.DataList li.Announcement div.Options{width:100px!important}\ ul.DataList div.Meta span, ul.DataList div.Meta strong{margin-right:4px!important;width:100%!important}\ a.BigButton{margin-bottom:6px!important;padding:0!important}\ #Bookmarks{max-height:330px!important;overflow:auto!important}\ #Bookmarks a,.Message,pre{word-wrap:break-word!important}\ pre,code{white-space:pre-wrap!important}\ #PagerAfter{margin-bottom:20px}\ #UserOptions{width:250px}\ .Box h4{color:#444!important;text-shadow:2px 2px 2px #999!important}\ .Box.About{width:230px}\ #Foot{display:none!important}\ #Panel .Box.CategoryFollowToggleBox,#dashboard_search_index .Box.GuestBox{position:fixed!important;right:4px!important;width:180px!important}\ .DataList .Meta a.Category{background:rgba(230,230,230,.5)!important}\ span.Title{display: block !important}\ a.Bookmark,a.Bookmarked,a.Bookmarking{position:absolute!important;right:0!important;top:0!important}\ a.Title{text-shadow:1px 1px 1px #AAA!important}\ .DataList a.Title{display:-moz-box!important}\ .DataList .Item{list-style:decimal outside!important;margin-left:20px!important}\ .DataList .ItemContent{margin:0 0 0 -4px!important}\ .Mine{background:none!important}\ #Head h1 a span,ul#Menu{text-shadow:1px 1px 1px #333!important}\ .HeadingTabs ul{margin:0 36px 0 10px!important}\ .MessageForm,.Tabs,.Headings{background:none!important;border:none!important;padding:0!important}\ .Item.Mine .MenuTitle,.Item.Mine .ToggleFlyout .Flyout{margin-left:-30px!important;width:40px!important}\ .Item.Mine .MenuTitle,.Item.Mine .ToggleFlyout .Flyout{left:-30px!important;position:relative!important}\ .Item:last-child,div.P,.Buttons,#PagerMore{margin-bottom:20px!important}\ .Box{-moz-border-radius: 4.5px !important;border:1px solid #BBE2F7!important;box-shadow:3px 3px 2px #999999!important}\ .Drafts .ItemContent a.Title,.Discussions .ItemContent a.Title{max-width:715px!important}\ '); // CSS Forum Extract ================================================================== addStyle('\ #filterContainer{height:24px}\ #filterContainer>*{display:inline}\ #filterGroup{-moz-border-radius:2px;background:transparent!important;cursor:pointer;padding:0}\ #filterCount,div.Tabs li.Active span{-moz-border-radius:3px;color:#FFF;margin-left:4px;padding:0 2px;pointer-events:none}\ div.Tabs li.Active span{background:rgba(0,0,0,0.6)}\ #filterCount{background:#1E79A7!important;font-size:80%!important;padding:1px 2px!important}\ #okBtn,#Head form input.Button{-moz-border-radius:0 2px 2px 0}\ #okBtn,#remBtn,#clrBtn,#Head form input.Button{border:none!important;color:#1E79A7!important;cursor:pointer!important;font-weight:bold!important;height:24px!important;padding:0 7px!important}\ #remBtn{position:relative;top:-5px}\ #okBtn,#Head form input.Button{background:-moz-linear-gradient(left,#FFF 10%,#CFECFF)}\ #okBtn,#clrBtn,#keywordIn,#Form_Search,#Head form input.InputBox,#Head form input.Button{text-shadow:1px 1px 1px #999}\ #Head form input.Button{font-size:100%!important;-moz-box-shadow:none!important}\ #okBtn:hover,#Head form input.Button:hover{background:-moz-linear-gradient(left,#FFF 10%,#2595CB)}\ #remBtn:hover,#okBtn:hover,#clrBtn:hover,#Head form input.Button:hover{color:#FFF}\ #filterLabel{color:#02475A;margin-right:4px;padding:2px}\ #filterLabel:hover span{text-shadow:none}\ #searchLab{-moz-user-select:none;color:#FFF;margin-right:8px}\ .Item[filtered] span.Author:before,.Item[filtered] .Discussion a.Title:before,.Item[filtered] .Activity div.Title:before,.Item[filtered] .Conversation a.Name:before{content:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAABlklEQVR42qWTv0vDQBTHL5NVEIKD4LWIFDe12kXEvyCDOAs66+Lm4upuNwkouDn4J3Ry6CAoakmrFqE2ihCcbGhtrIPE70tefhijIB58ecflvp97791FkVKK/wzlRNPc03JZLGqaWKvVxrH2AvX+BHgGgEYDOpRyDqGZBjkqFNwq9pakzPFBbwpKyB3Y9lPbcYSKlXMfMotwH4dsWZZr+9+WEdrQDUUCDGGSh6a2Leu4g8l7BGlBrzHzCoIL3fIBXgZ0wCA0AmX3LevMiCBFZFe9Q3alFLPXg8QtUDaTgBgGLxAZ5lWEDzY3A3MagMYwmtWhm6EsBiBdyk2ES+iaSvpyC0kAdTowz/MaN3YBoQ45PwIC8yjmY9CGlDsIXZS0y5AZbqzzDUBmeg8NPpnNj1y3GzRXT0A8AJl7MJtc4J5vfoAueDONPPbVnUpFrKtqCPEAoLvd6CXGzeF18Q15EDoMGU4TJMyAatd9s8kdj5tFEoL/Zgnzq6AHWagIZTiRVoo5DpmA6OWb8Zeo8gZ6533x+8iw+p+ik780jj8a+QAAAABJRU5ErkJggg==);margin-right:6px;position:relative;top:2px}\ #scrBtn{color:#02475A;cursor:pointer;margin:-1px 4px 0 0;padding:2px 4px;text-shadow:2px 2px 2px #999}\ #scrBtn:hover,#filterLabel:hover{color:#000}\ #clrBtn,#remBtn{-moz-border-radius:2px 0 0 2px;height:24px;width:24px}\ #clrBtn{background:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAAY0lEQVR42mM8/+b/fwYoYAJhRghmZkSw4XwGLGLImAFTjHHUghFowfktCxkoAeHR8YQtsLKyIsvwY8eOkWbBsmXLGAwMDBi0tLRGLRi1YMRaQCog2gJKAEELhn5pOmoB3S0AAEj0uXEXAiVLAAAAAElFTkSuQmCC)no-repeat}\ #clrBtn:hover{background:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAAcklEQVR42mPUmHb6Py8bMwMbCxMDGzMjA4jNzswEptlgNAsjgo2kBsTmAbFZMOVYoWzGUQtGoAX2d9czUAISC8oJW1BfX0+W4Y2NjaRZwMjIyHDgwAEGe3v7UQtGLRixFpAKiLaAEkDQgqFfmo5aQHcLACuGrMnpoBzdAAAAAElFTkSuQmCC)no-repeat}\ #remBtn{background:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAABgUlEQVR42mM8/+b/fwYoYAJhRghmZkSw4XwGLGLImAFTjHHUgsFpQXtuNMP3798ZREVFGcq6Z1Lfgg3TWhjev38PFrtx4wbDlBVbcVqwfskchv379zPMWLCUtCBaN7WF4c2bNwwCAgIMp0+fZpi+ciuGBYUp0QwfPnxgWLZ+K/lx0JqfwPDp0yeGnz9/MsxcuRUuX5wKMXzJuq2UR/Kto9sZZs+eDbZk9qqtDPP6WxiuX7/OMGnuUuqlohtHIJaAACcnJ0P/nKXUTaZ7V85h2LZtG9gX7OzsDDOWrqOeBftXIQzPyckBq50yZQrDorVbKbfg4GqI4aA8ERAQwKBv5wkWP39wO9gSiiL58Jo54MgE5QWQy3VtPVE0nz0AiZf5K9aRbsHDE9sZTp48yfDgwQOGL1++MPQtWIMzo7148YIhv7yGNAtWTWxg+Pz5M8GcDKLXLp7DIC0tzWDn4km8BV2FkAzWvWAdUWXR6kVzGCLjU0grKsJza4ZocT1qAV0tAAAuewGAPJPF+gAAAABJRU5ErkJggg==)no-repeat}\ #remBtn:hover{background:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAABVElEQVR42mP8X1X1nwEG2NggmJWVgYGdHZXm5GRgYGZG8EGYiwtVD0gepA5JDeOoBYPTgqiqKoZ/QC5QGcPCefOob0ER0IKPUKFPQLx68WKcFqzIzGTYdPYsw7Lbt0kLoqLSUoYPQCGgMoZ3IEvWrMGwIMrBgeE3SO7aNfLjIAbowj9Aqb8gg9avh4tHubpCDL9wgfJIXjF1KsMGYDCALdm2jaHIy4vhBZC97NQp6qWiFRMmgC0BASaQ4QcOUDeZwiwA+QJoDMMKalqAHETBxsZgpWuB/NXUCKIVc+aADQflCU+g4RHNzRDxigqIJZRE8oqFCxl2Aw35BHV5RE0NiuYVxcVgy1eQk0xXrFjBsB+o+StQGJRMV2DJB7CMdgqoro/UjJYOzGh/iMjJIPUrkpPB2iNWrybeghioBSuILItWxMaSZgGoqOibPn2IFtejFtDVAgBmi9ppd4XBuQAAAABJRU5ErkJggg==)no-repeat}\ #Head input#Form_Search{font-weight:normal!important;text-align:center!important}\ #Head input#Form_Search:focus{font-weight:bold!important;text-align:left!important}\ #Head input#keywordIn{-moz-appearance:none;background:#FFF;border:none;color:#1E79A8;font-family:tahoma,sans-serif!important;font-weight:normal!important;height:24px;width:180px!important;padding:0px;text-align:center!important}\ #Head input#keywordIn:focus{color:#1E79A8;font-weight:bold!important;text-align:left!important}\ '); var aaa = $('#Content'), bbb = aaa.children[0], ccc = (aaa.clientWidth - bbb.clientWidth) / 2; bbb.style.left = ccc + 'px'; // Auto insert ======================================================================== $('#Body').addEventListener('mouseup', getActiveText, false); var getText = ""; function getActiveText() { var getText = '', wdIn = $('#keywordIn'); getText = getSelection().toString(); if(getText != '') { if(wdIn.value == '') wdIn.value = getText.trim(); else wdIn.value = wdIn.value + ',' + getText.trim(); } return; } // Filter Inputbox ==================================================================== var div = $c('div', {id:'filterContainer'}); var filterGrp = $c('td', {id:'filterGroup', title:getValue('Keywords') ? getValue('Keywords').replace(/,/gi, ' <> ') : 'Empty'}, [{type:'click', fn:function(e) {filter(e)}}]); var filterLab = $c('button', {id:'filterLabel', textContent:'Filtered'}); var filterCnt = $c('span', {id:'filterCount', textContent:0}); var rem = $c('button', {id:'remBtn', title:'Delete Keyword'}, [{type:'click', fn:function(e) {remKey(); e.preventDefault()}}]); var inp = $c('input', {id:'keywordIn', title:'Separate multiple entries with comma and no spacing (case sensitive)', placeholder:'Case-Sensitive Filter'}, [{type:'click', fn:function(e) {getKey(e)}}]); var okb = $c('button', {id:'okBtn', textContent:'Ok', title:'Create Filter'}, [{type:'click', fn:function(e) {genKey(); e.preventDefault()}}]); var con = $('#Head').children[0].children[2]; filterLab.appendChild(filterCnt); filterGrp.appendChild(filterLab); div.appendChild(filterGrp); div.appendChild(rem); div.appendChild(inp); div.appendChild(okb); con.appendChild(div, con); var clearBtn = $c('button', {id:'clrBtn', title:'Clear Field'}, [{type:'click', fn:function(e) {srch.value = ''; e.preventDefault(); srch.focus()}}]); var scrB = $c('button', {id:'scrBtn', textContent:'Scroll'}, [{type:'click', fn:function(e) {scroll(); e.preventDefault()}}]); var srch = $('#Form_Search'); srch.parentNode.insertBefore(scrB, srch); srch.parentNode.insertBefore(clearBtn, srch); srch.placeholder = 'Search'; // Scroll ============================================================================= function scroll() { var scrY = document.defaultView.scrollY; var scrMin = document.defaultView.scrollMaxY / 2; var scrMax = document.defaultView.scrollMaxY; if(scrY == 0) content.body = scrollTo(0, scrMin); else if(scrY == scrMax) content.body = scrollTo(0, 0); else content.body = scrollTo(0, scrMax); } // On load ============================================================================ var nameList = [], undoList = [], item = $('.Item'), itemContent = $('.ItemContent'); var gvki = $('#keywordIn'), gvkw = getValue('Keywords'), kw = gvkw.split(','), listCnt = 0; if(getValue('Keywords') == '') return; for(k = 0; k < kw.length; k++) nameList.push(kw[k]); for(var x in nameList) for(var i = 0; i < item.length; i++) if(item[i].textContent.indexOf(nameList[x]) != -1) { item[i].style.visibility = 'hidden'; item[i].style.height = '0'; item[i].style.padding = '0'; item[i].setAttribute('filtered', true); if(item[i].hasAttribute('filtered')) listCnt++; } $('#filterCount').textContent = listCnt; // Get keywords ======================================================================= function getKey(e) { if(e.button == 1) gvki.value = gvkw; } // Create Keyword ===================================================================== function genKey(e) { if(gvki.value == '') return; if(gvkw == '') setValue('Keywords', gvki.value); else setValue('Keywords', gvkw + ',' + gvki.value); gvki.value = ''; document.location.reload(); } // Remove Keyword ===================================================================== function remKey() { var wi = $('#keywordIn'); if(wi.value == '') return; var names = [], undo = [], kw = getValue('Keywords').split(','), kwu = wi.value.split(','); for(k = 0; k < kw.length; k++) names.push(kw[k]); for(i = 0; i < kwu.length; i++) undo.push(kwu[i]); var Array1 = names, Array2 = undo; for (var i = 0; i < Array2.length; i++) { var arrlen = Array1.length; for (var j = 0; j < arrlen; j++) if (Array2[i] == Array1[j]) Array1 = Array1.slice(0, j).concat(Array1.slice(j+1, arrlen)); } var newStr = Array1.toString(); setValue('Keywords', newStr); $('#keywordIn').value = ''; document.location.reload(); } // Filter link click ================================================================== function filter(e) { if($('#filterCount').textContent == 0) return; switch(e.target.firstChild.textContent) { case 'Filtered': for(var i = 0; i < item.length; i++) { if(item[i].getAttribute('filtered')) { item[i].style.visibility = 'visible'; item[i].style.height = 'auto'; item[i].style.paddingBottom = '4px'; item[i].style.paddingTop = '4px'; } } $('#filterLabel').firstChild.textContent = 'Unfiltered'; break; case 'Unfiltered': for(var i = 0; i < item.length; i++) { if(item[i].hasAttribute('filtered')) { item[i].style.visibility = 'hidden'; item[i].style.height = '0'; item[i].style.padding = '0'; item[i].setAttribute('filtered', true); } } $('#filterLabel').firstChild.textContent = 'Filtered'; break; }}
Mozilla add on,User script,Grease Monkey Script, greasemonkey userscripts, updater userscripts mafia wars userscripts mafia wars autoplayer userscripts mafia wars wall userscripts scripts userscripts travian greasemonkey greasemonkey download greasemonkey facebook greasemonkey tutorial greasemonkey youtube greasemonkey travian greasemonkey chrome greasemonkey mafia wars greasemonkey mafia wars autoplayer
Wednesday, December 7, 2011
Forum Extract
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment