SingSnap Comment At Top v2

By xenomark Last update Oct 22, 2008 — Installed 303 times. Daily Installs: 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 2, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1

There are 2 previous versions of this script.

// ==UserScript==

// @name           SingSnap Comment At Top v2

// @namespace      xeno

// @include        http://www.singsnap.com/snap/r/*

// @include        http://www.singsnap.com/snap/playlist/*

// @include        http://www.singsnap.com/snap/watchandlisten/play/*

// @include        http://www.singsnap.com/snap/watchAndListen/play/*

// ==/UserScript==



var thisurl = window.location.href;
isplaylist = thisurl.substring(thisurl.indexOf('playlist'));
isplaylist = isplaylist.substring(0,isplaylist.indexOf('playlist') + 8);

if (isplaylist != "playlist") {


allinfo = document.evaluate(                                 
    		'/HTML[1]/BODY[1]/DIV[1]/DIV[1]/DIV[3]/DIV[2]', document, null,
    		XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);
		for (var i = 0; i < allinfo.snapshotLength; i++) {
    			thisinfo = allinfo.snapshotItem(i);

info = thisinfo.innerHTML;
id = info.substring(info.indexOf('#') + 1);
id = id.substring(0,id.indexOf('<'));


}


}

else {


allinfo = document.evaluate(                                 
    		'/HTML[1]/BODY[1]/DIV[1]/DIV[1]/DIV[3]/DIV[3]', document, null,
    		XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);
		for (var i = 0; i < allinfo.snapshotLength; i++) {
    			thisinfo = allinfo.snapshotItem(i);

info = thisinfo.innerHTML;
id = info.substring(info.indexOf('#') + 1);
id = id.substring(0,id.indexOf('<'));

}

}




allforms = document.evaluate(                                 
    		'/HTML[1]/BODY[1]/DIV[1]/DIV[1]/DIV[3]/FORM[1]/FIELDSET[1]', document, null,
    		XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);
		for (var i = 0; i < allforms.snapshotLength; i++) {
    			form = allforms.snapshotItem(i);

fieldset = form.innerHTML;
}



comment = '<form action="/snap/watchandlisten/submitcomment/' + 
     id + 
     '" method="post" onsubmit="new Ajax.Request(\'/snap/watchandlisten/submitcomment/' + 
     id + 
     '\', { asynchronous:true,parameters:Form.serialize(this),onLoading:function(){$(\'comments_indicator\').setStyle({display: \'inline\'});},onComplete:function(){ajaxPagination(null, Math.ceil(window.snap$totalRecords/window.snap$perPage), null, null, true);$(\'comments_indicator\').setStyle({display: \'none\'});$(\'new_comment_body\').value=\'\';}}); return false;" class="standard-form">' +
     fieldset +
    '</form>';


//document.body.insertBefore(comment, thisinfo);
var newdivstart = '<div style="position:absolute; white-space:nowrap;z-index:26; background-color:#337196; display:block; width:400px; height:36px;padding:0px"><table style="padding:0px"><tr>';
var infobtn = '<td id="infobtn"  style="width:200px; height:34px; background-color:6594b0; padding-left:10px; font-weight:bold; font-family: arial; color:white;">INFORMATION</td>';
var cmtbtn = '<td id="cmtbtn"   style="width:200px; height:34px; background-color:#2d83a3; padding-right:10px; text-align:right; font-weight:bold; font-family: arial;color:white" >ADD A COMMENT';
var newdivend = '</td></tr></table></div>';
var newcommentbox = '<div id="newcomt" style="position:absolute; margin-top:7px; z-index:25; margin-left: -199px; padding-left:0px; overflow:hidden; background-color:white; width:400px; height:214px; text-align: center;">' +
     comment +
     '</div>' ;
style = '<style>#cmtbtn div {display:none;} #cmtbtn:hover div {display:block;} #newcomt legend {margin-left:300px;font-weight:bold !important; font-size:24px;;} #newcomt dt {display:none;} #newcomt textarea {width:380px !important; height: 160px; margin-top:-20px;}</style>'

infobox = newdivstart + style + infobtn + cmtbtn + newcommentbox + newdivend + info + style ;

thisinfo.innerHTML = infobox;