// KLDP Point position change // // version 0.1 BETA! // 2007-02-02 // // Copyright (c) 2007, 1day1 in KLDP (http://kldp.org/blog/15958) // Released under the GPL license // http://www.gnu.org/copyleft/gpl.html // // -------------------------------------------------------------------- // // This is a Greasemonkey user script. To install it, you need // Greasemonkey 0.3 or later: http://greasemonkey.mozdev.org/ // Then restart Firefox and revisit this script. // Under Tools, there will be a new menu item to "Install User Script". // Accept the default configuration and install. // // To uninstall, go to Tools/Manage User Scripts, // select "KLDP Point position change", and click Uninstall. // // ChangeLog: // 2007-02-02 - 0.1 Beta - release modify , option variables. & best point post bg highlighting // 2007-02-01 - 0.05 - new post bg highlighting & minus point hiding. // 2007-01-30 - 0.01 - change point position // ==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== // options // -------------------------------------------------------------------- // minus point hiding color option var hide_bgcolor = '#708090' ; // dark gray : #C0C0C0 var view_hide_button_bgcolor = '#d3d3d3' ; // blue : #6699FF var hide_minus_point_limit = -10 ; // best point post highlighting. var highlighting_bgcolor = '#eee8aa' ; // gray : #E0E0E0 , yellow : #FFFFCC var highlighting_point_limit = 10 ; // new comment highlighting var newComment_bgcolor = '#D9EAB3' ; // point color (box,button bg) var point_box_bgcolor = '#E4E4E4' ; // gray : #7F7F7F , #E0E0E0 , #f0e68c var point_button_bgcolor = '#9F9F9F' ; // dark gray : #9F9F9F , #deb887 , #f5deb3 // point up/down button img var up_act_img = 'http://wiki.kldp.org/pds/1day1/a_up_act2.png' ; var up_inact_img = 'http://wiki.kldp.org/pds/1day1/a_up_inact2.png' ; var down_act_img = 'http://wiki.kldp.org/pds/1day1/a_down_act2.png' ; var down_inact_img = 'http://wiki.kldp.org/pds/1day1/a_down_inact2.png' ; // main script // -------------------------------------------------------------------- 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() { // new img - point up/down this.addGlobalStyle('.vote-up-act, .vote-up-inact:hover { background: url(' + up_act_img + ') no-repeat 0px 0px; }'); this.addGlobalStyle('.vote-up-inact, .up-inact { background: url(' + up_inact_img + ') 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(' + down_act_img + ') no-repeat 0px 0px; }'); this.addGlobalStyle('.vote-down-inact, .down-inact { background: url(' + down_inact_img + ') 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; }'); // "//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() var highlightComment = 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 <= hide_minus_point_limit ) hiddenComment[i] = 'hidden' ; if( point >= highlighting_point_limit ) highlightComment[i] = 'highlight' ; // thisDiv.style['float'] = 'left'; thisDiv.style['display'] = 'block'; // thisDiv.style['width'] = '128px'; thisDiv.style['width'] = '108px'; thisDiv.style['height'] = '36px'; thisDiv.style['textAlign'] = 'center'; // thisDiv.style['overflow'] = 'hidden'; // thisDiv.style['fontSize'] = '20pt'; thisDiv.style['marginRight'] = '5px'; // 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'] = point_box_bgcolor; } for (var i = 0; i < commentDivs.snapshotLength; i++) { thisDiv4 = commentDivs.snapshotItem(i); // minus point hide if( hiddenComment[i+1] == 'hidden' ) { var logo = document.createElement("div"); logo.innerHTML = '
' + '[View/Hide]' + '