// ==UserScript== // @name KLDP Point position change // @namespace http://kldp.org // @description KLDP Point position change // @include http://kldp.org/* // @include http://www.kldp.org/* // ==/UserScript== var CustomizeKLDP = { // add arbitrary CSS styles to page addGlobalStyle: function(css) { style = document.createElement("style"); style.type = "text/css"; style.innerHTML = css; document.getElementsByTagName('head')[0].appendChild(style); }, changePoint: function() { /* // tags to hide var hideme = new Array('iframe'); // loop thru the hidden tags array for ( x = 0; x < hideme.length; x++ ) { // get all tags of that name var tags = document.getElementsByTagName(hideme[x]); // loop thru those tags and set them not to show for ( y = 0; y < tags.length; y++ ) { if (tags[y].src.indexOf('http://nv') != -1) { tags[y].style['display'] = 'none'; continue; } } } */ // this.addGlobalStyle('#block-block-5 { display: none }'); // this.addGlobalStyle('.content { display: none }'); // this.addGlobalStyle('.vote-up-down-widget { float: right; xdisplay: none; background-color : #FFCC00;}'); // this.addGlobalStyle('.links span .vote-points { display: none }'); // this.addGlobalStyle('.links span { float:right; position:relative; margin-top: -79px ; xdisplay: none; }'); // this.addGlobalStyle('.vote-up-act, .vote-up-inact, .vote-down-act, .vote-down-inact, .up-inact, .down-inact { display: inline; width: 15px; height: 16px;}'); /* this.addGlobalStyle('.vote-up-act, .vote-up-inact:hover { background: url(a_up_act.png) no-repeat 0px 0px; }'); this.addGlobalStyle('.vote-up-inact, .up-inact { background: url(a_up_inact.png) no-repeat 0px 0px; }'); this.addGlobalStyle('.vote-down-act, .vote-down-inact:hover { background: url(a_down_act.png) no-repeat 0px 0px; }'); this.addGlobalStyle('.vote-down-inact, .down-inact { background: url(a_down_inact.png) no-repeat 0px 0px; }'); this.addGlobalStyle('.vote-up-down-widget-alt .vote-up-inact:hover { background: url(plus_act.png) no-repeat center 3px; }'); this.addGlobalStyle('.vote-up-down-widget-alt .up-inact {background: url(plus_inact.png) no-repeat center 3px;}'); */ this.addGlobalStyle('.vote-up-act, .vote-up-inact:hover { background: url(http://wiki.kldp.org/pds/1day1/a_up_act2.png) no-repeat 0px 0px; }'); this.addGlobalStyle('.vote-up-inact, .up-inact { background: url(http://wiki.kldp.org/pds/1day1/a_up_inact2.png) no-repeat 0px 0px; }'); // this.addGlobalStyle('.vote-up-act, .vote-up-inact:hover { background: url(http://digg.com/img/c-digg.png) no-repeat 0px 0px; }'); this.addGlobalStyle('.vote-down-act, .vote-down-inact:hover { background: url(http://wiki.kldp.org/pds/1day1/a_down_act2.png) no-repeat 0px 0px; }'); this.addGlobalStyle('.vote-down-inact, .down-inact { background: url(http://wiki.kldp.org/pds/1day1/a_down_inact2.png) no-repeat 0px 0px; }'); // this.addGlobalStyle('.vote-down-act, .vote-down-inact:hover { background: url(http://digg.com/img/c-bury.png) no-repeat 0px 0px; }'); // this.addGlobalStyle('.vote-up-down-widget-alt .vote-up-inact:hover { background: url(plus_act.png) no-repeat center 3px; }'); // this.addGlobalStyle('.vote-up-down-widget-alt .up-inact {background: url(plus_inact.png) no-repeat center 3px;}'); // "//div[@class='links']", // var thisDiv , thisDiv2 , thisDiv3 , thisDiv4 , newthisDiv ; var allDivs, voteDivs , commentDivs , newDivs ; linkDivs = document.evaluate( "//div[@class='links']", document, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null); allDivs = document.evaluate( "//span[@class='vote-points']", document, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null); newDivs = document.evaluate( "//span[@class='new']", document, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null); voteDivs = document.evaluate( "//div[@class='vote-up-down-widget']", document, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null); commentDivs = document.evaluate( "//div[@class='comment']", document, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null); var hiddenComment = new Array() for (var i = 0; i < allDivs.snapshotLength; i++) { thisDiv = allDivs.snapshotItem(i); // do something with thisDiv // alert( thisDiv.id.innerHTML ) ; if( i != 0 ) var point = parseInt( document.getElementById(thisDiv.id).innerHTML ) ; if( point < -5 ) hiddenComment[i] = 'hidden' ; // thisDiv.style['float'] = 'left'; thisDiv.style['display'] = 'block'; thisDiv.style['width'] = '88px'; thisDiv.style['height'] = '36px'; thisDiv.style['font-size'] = '20pt'; thisDiv.style['marginRight'] = '10px'; // thisDiv.style['marginLeft'] = '2px'; // thisDiv.style['paddingLeft'] = '2px'; thisDiv.style['padding'] = '2px'; thisDiv.style['float'] = 'right'; thisDiv.style['border'] = '1px solid #3F3F3F'; thisDiv.style['backgroundColor'] = '#7F7F7F'; } // click /* function clickNav(e) { if (!e) var e = window.event; if (e.target) var tg = e.target; else if (e.srcElement) var tg = e.srcElement; while (tg.nodeName != 'DIV') // Safari GRRRRRRRRRR tg = tg.parentNode; var nextSib = tg.nextSibling; while (nextSib.nodeType != 1) nextSib = nextSib.nextSibling; var nextSibStatus = (nextSib.style.display == 'none') ? 'block' : 'none'; nextSib.style.display = nextSibStatus; } // var logo = document.createElement("div"); logo.innerHTML = '
' + " " + '
'; document.body.insertBefore(logo, document.body.firstChild); window.addEventListener( "load", function() { alert('test'); var x = document.getElementsByTagName('h3'); for (var i=0;i

' + '[View/Hide]' + '

'; thisDiv4.insertBefore(logo, thisDiv4.firstChild); // thisDiv4.onclick = toggleComment; // thisDiv4.style['display'] = 'none'; thisDiv4.style['display'] = 'block'; thisDiv4.style['overflow'] = 'hidden'; thisDiv4.style['backgroundColor'] = '#C0C0C0'; thisDiv4.style['height'] = '36px'; thisDiv4.style['display'] = 'block'; } } for (var i = 0; i < newDivs.snapshotLength; i++) { newthisDiv = newDivs.snapshotItem(i); // span -> div comment // alert( newthisDiv.parentNode.id ) ; var newCommentDiv = newthisDiv.parentNode ; newCommentDiv.style['backgroundColor'] = '#D9EAB3'; /* if( hiddenComment[i+1] == 'hidden' ) { // thisDiv4.style['display'] = 'none'; thisDiv4.style['display'] = 'block'; thisDiv4.style['overflow'] = 'hidden'; thisDiv4.style['backgroundColor'] = '#666633'; thisDiv4.style['height'] = '36px'; } */ } for (var i = 0; i < voteDivs.snapshotLength; i++) { thisDiv2 = voteDivs.snapshotItem(i); // do something with thisDiv // thisDiv2.style['float'] = 'left'; thisDiv2.style['clear'] = 'none'; thisDiv2.style['display'] = 'block'; thisDiv2.style['marginLeft'] = '2px'; // thisDiv2.style['position'] = 'relative'; thisDiv2.style['backgroundColor'] = '#9F9F9F'; // newElement = document.createElement('hr'); // thisDiv.parentNode.insertBefore(thisDiv2, thisDiv); // thisDiv = allDivs.snapshotItem(i); // thisDiv2.parentNode.insertBefore(thisDiv, thisDiv2); } for (var i = 0; i < linkDivs.snapshotLength; i++) { thisDiv3 = linkDivs.snapshotItem(i); thisDiv2 = voteDivs.snapshotItem(i); thisDiv = allDivs.snapshotItem(i); thisDiv3.style['float'] = 'left'; // thisDiv3.style['display'] = 'block'; thisDiv3.style['marginBottom'] = '2px'; // 20px // newDiv = document.createElement("div"); // thisDiv3.appendChild(newDiv); // newDiv.parentNode.insertBefore(thisDiv2, newDiv); // newDiv.parentNode.insertBefore(thisDiv, newDiv); // thisDiv3.parentNode.insertBefore(thisDiv2, thisDiv3.nextSibling); // thisDiv3.parentNode.insertBefore(thisDiv, thisDiv3.nextSibling); thisDiv3.parentNode.insertBefore(thisDiv2, thisDiv3); thisDiv3.parentNode.insertBefore(thisDiv, thisDiv3); // thisDiv3.parentNode.insertBefore(newDiv, thisDiv3); } /* //