[quote=ily]bro
gimana cara Pop-up Comment
nya tuch ga sembunyi spt punya aq nech?
punya aq kan harus di ADD coments na dulu baru keliatan gt...
http://profiles.friendster.com/p4c3
mohon bantuan na,,,,[/quote]
[spoiler]
// onLoad handler
if (!attachOnLoadHandler(function() { COMMENTOR.init();})) window.onload = function() { COMMENTOR.init();};
//-----------------------------
if (typeof COMMENTOR == "undefined") { COMMENTOR = {}; }
COMMENTOR = {
$linker: [],
$max: 1000,
$amp: "&",
$width: "468px",
$insty: "",
$DOM: (document.getElementById) ? true : false,
$NS5: ((navigator.userAgent.indexOf("Gecko")>-1) && COMMENTOR.$DOM) ? true: false,
$IE5: ((navigator.userAgent.indexOf("MSIE")>-1) && COMMENTOR.$DOM) ? true : false,
$NS4: (document.layers && !COMMENTOR.$DOM) ? true : false,
$IE4: (document.all && !COMMENTOR.$DOM) ? true : false,
inputstyle: {
"padding": "4px 0",
"margin": "10px 0 6px 0",
"font-family": "tahoma",
"font-weight": "bold",
"color": "#ffffff",
"border": "1px solid #ffffff",
"background-color": "transparent"
},
init: function() {
var myFriend = "no";
var cScan = COMMENTOR.$("controlPanelButtons").innerHTML;
var searchFriend = cScan.search(/Add as Friend/);
if (searchFriend > 0) {
myFriend = "yes";
}
if(pageViewerID !== "" && myFriend == "no") {
try {
var ls = [];
var olinks = document.links;
for (var x=0;x<olinks.length;x++) {
if (olinks[x].innerHTML.match(/Post a Comment|Add Comment/)) {
ls.push(olinks[x]);
}
}
COMMENTOR.$linker = ls;
COMMENTOR.$linker[0] = COMMENTOR.replaceHtml(COMMENTOR.$linker[0],"Add Comment");
COMMENTOR.$linker[0].setAttribute("href","javascript:void(COMMENTOR.openForm());");
try {
COMMENTOR.$linker[1] = COMMENTOR.replaceHtml(COMMENTOR.$linker[1],"Post a Comment");
COMMENTOR.$linker[1].setAttribute("href","javascript:void(COMMENTOR.openForm());");
}catch(e){}
try {
COMMENTOR.$linker[2] = COMMENTOR.replaceHtml(COMMENTOR.$linker[2],"Post a Comment");
COMMENTOR.$linker[2].setAttribute("href","javascript:void(COMMENTOR.openForm());");
}catch(e){}
/* uncomment to show the comment box permanently */
//COMMENTOR.openForm();
}catch(e) {
COMMENTOR.$linker = "";
}
COMMENTOR.hideStatus();
}
},
openForm: function() {
COMMENTOR.$linker[0].setAttribute("href","#quickcomment");
try {
COMMENTOR.$linker[1].setAttribute("href","#quickcomment");
}catch(e){}
try {
COMMENTOR.$linker[2].setAttribute("href","#quickcomment");
}catch(e){}
smlist = [];
smlist.push("1");smlist.push("2");smlist.push("3");smlist.push("4");smlist.push("5");
smlist.push("6");smlist.push("7");smlist.push("8");smlist.push("9");smlist.push("10");
smlist.push("11");smlist.push("12");smlist.push("13");smlist.push("14");smlist.push("15");
smlist.push("16");smlist.push("17");smlist.push("18");smlist.push("19");smlist.push("20");
smlist.push("21");smlist.push("22");smlist.push("23");smlist.push("24");smlist.push("25");
smlist.push("26");smlist.push("27");smlist.push("28");smlist.push("29");smlist.push("30");
smlist.push("31");smlist.push("32");smlist.push("33");smlist.push("34");smlist.push("35");
smlist.push("36");smlist.push("37");smlist.push("38");smlist.push("39");smlist.push("40");
smlist.push("41");smlist.push("42");smlist.push("43");smlist.push("44");smlist.push("45");
smlist.push("46");smlist.push("47");smlist.push("48");smlist.push("52");smlist.push("53");
smlist.push("62");smlist.push("63");smlist.push("64");smlist.push("65");smlist.push("66");
smlist.push("67");smlist.push("68");smlist.push("69");smlist.push("70");smlist.push("71");
smlist.push("76");smlist.push("77");smlist.push("78");
smileys = [];
for (var sm=0;sm<smlist.length;sm++) {
smileys[smlist[sm]] = "http://us.i1.yimg.com/us.yimg.com/i/mesg/emoticons7/"+smlist[sm]+".gif";
}
smdiv = document.createElement("div");
smdiv.className = "smileysdiv";
COMMENTOR.changeText(smdiv,"");
for (sm=0;sm<smlist.length;sm++) {
// this would be so much easier with innerHTML, darn you standards fetish!
smdiv.innerHTML += "<span class=\"smbox\"><a href=\"javascript:void(0);\" onclick=\"COMMENTOR.rtxt('::"+smlist[sm]+"::', COMMENTOR.$('komen')); return false;\"><img class=\"smiley\" title=\""+smlist[sm]+"\" src=\""+smileys[smlist[sm]]+"\"></a></span>";
}
for (var s in COMMENTOR.inputstyle) {
COMMENTOR.$insty += s+":"+COMMENTOR.inputstyle[s]+";";
}
var commform = "<div style=\"DISPLAY: block;padding: 6px 11px;\" class=\"commentor\">"+
"<p style=\"font-style: ; font-size: 100%\">Quick Comment SmarterDOS<br>Mendingan kirim comment disini aja ya ....<br>Lebih enak, praktis, cepat pula ...<br>Bisa dimasukin Emote lagi ..."+
"<form id=\"testimonial_form\" name=\"testimonial_form\" method=\"post\" onsubmit=\"return checkFormSubmit('testimonial_form');\">"+
"<input type=\"hidden\" name=\"testimonial_firstname\" value=\""+pageOwnerFName+"\">"+
"<input type=\"hidden\" name=\"testimonial_uid\" value=\""+pageViewerID+"\">"+
"<input type=\"hidden\" name=\"_submitted\" value=\"1\">"+
"<div style=\"width:"+COMMENTOR.$width+"\">"+
"<img border=\"0\" src=\"http://h1.ripway.com/feruzz/friendster/photo/commentor/bold.gif\" name=\"bold\" type=\"image\" onClick=\"COMMENTOR.insertTag('<b>','</b>');\" class=\"postimage\" title=\"bold\"> "+
"<img border=\"0\" src=\"http://h1.ripway.com/feruzz/friendster/photo/commentor/italic.gif\" name=\"italic\" type=\"image\" onClick=\"COMMENTOR.insertTag('<i>','</i>');\" class=\"postimage\" title=\"italic\"> "+
"<img border=\"0\" src=\"http://h1.ripway.com/feruzz/friendster/photo/commentor/under.gif\" name=\"underline\" type=\"image\" onClick=\"COMMENTOR.insertTag('<span style=text-decoration:underline>','</span>');\" class=\"postimage\" title=\"underline\"> "+
"<img border=\"0\" src=\"http://h1.ripway.com/feruzz/friendster/photo/commentor/sup.gif\" name=\"sup\" type=\"image\" onClick=\"COMMENTOR.insertTag('<big>','</big>');\" class=\"postimage\" title=\"superscript\"> "+
"<img border=\"0\" src=\"http://h1.ripway.com/feruzz/friendster/photo/commentor/sub.gif\" name=\"sub\" type=\"image\" onClick=\"COMMENTOR.insertTag('<small>','</small>');\" class=\"postimage\" title=\"subscript\"> "+
"<img border=\"0\" src=\"http://h1.ripway.com/feruzz/friendster/photo/commentor/strike.gif\" name=\"strike\" type=\"image\" onClick=\"COMMENTOR.insertTag('<del>','</del>');\" class=\"postimage\" title=\"strike\"> "+
"<img border=\"0\" src=\"http://h1.ripway.com/feruzz/friendster/photo/commentor/center.gif\" name=\"center\" type=\"image\" onClick=\"COMMENTOR.insertTag('<div align=center>','</div>');\" class=\"postimage\" title=\"center\"> "+
"<select name=\"fnt_color\" id=\"fnt_color\" onChange=\"javascript:COMMENTOR.insertTag('<span style=color:'+COMMENTOR.$('testimonial_form').fnt_color.options[fnt_color.selectedIndex].value+'>', '</span>'); COMMENTOR.$('testimonial_form').fnt_color.options[0].selected=true\">"+
"<option value=\"\">Ubah Warna"+
"<option value=\"#F0F8FF\">AliceBlue<option value=\"#FAEBD7\">AntiqueWhite<option value=\"#00FFFF\">Aqua<option value=\"#7FFFD4\">AquaMarine"+
"<option value=\"#F0FFFF\">Azure<option value=\"#F5F5DC\">Beige<option value=\"#FFE4C4\">Bisque<option value=\"#000000\">Black"+
"<option value=\"#FFEBCD\">BlanchedAlmond<option value=\"#0000FF\">Blue<option value=\"#8A2BE2\">BlueViolet<option value=\"#A52A2A\">Brown"+
"<option value=\"#DEB887\">BurlyWood<option value=\"#5F9EA0\">CadetBlue<option value=\"#7FFF00\">Chartreuse<option value=\"#D2691E\">Chocolate"+
"<option value=\"#FF7F50\">Coral<option value=\"#6495ED\">CornflowerBlue<option value=\"#FFF8DC\">Cornsilk<option value=\"#DC143C\">Crimson"+
"<option value=\"#00FFFF\">Cyan<option value=\"#00008B\">DarkBlue<option value=\"#008B8B\">DarkCyan<option value=\"#B8860B\">DarkGoldenRod"+
"<option value=\"#A9A9A9\">DarkGray<option value=\"#006400\">DarkGreen<option value=\"#BDB76B\">DarkKhaki<option value=\"#8B008B\">DarkMagenta"+
"<option value=\"#556B2F\">DarkOliveGreen<option value=\"#FF8C00\">DarkOrange<option value=\"#9932CC\">DarkOrchid<option value=\"#8B0000\">DarkRed"+
"<option value=\"#E9967A\">DarkSalmon<option value=\"#8FBC8F\">DarkSeaGreen<option value=\"#483D8B\">DarkSlateBlue<option value=\"#2F4F4F\">DarkSlateGray"+
"<option value=\"#00CED1\">DarkTurquoise<option value=\"#9400D3\">DarkViolet<option value=\"#FF1493\">DeepPink<option value=\"#00BFFF\">DeepSkyBlue"+
"<option value=\"#696969\">DimGray<option value=\"#1E90FF\">DodgerBlue<option value=\"#B22222\">FireBrick<option value=\"#FFFAF0\">FloralWhite"+
"<option value=\"#228B22\">ForestGreen<option value=\"#FF00FF\">Fuchsia<option value=\"#DCDCDC\">Gainsboro<option value=\"#F8F8FF\">GhostWhite"+
"<option value=\"#FFD700\">Gold<option value=\"#DAA520\">GoldenRod<option value=\"#808080\">Gray<option value=\"#008000\">Green"+
"<option value=\"#ADFF2F\">GreenYellow<option value=\"#F0FFF0\">HoneyDew<option value=\"#FF69B4\">HotPink<option value=\"#CD5C5C\">IndianRed"+
"<option value=\"#4B0082\">Indigo<option value=\"#FFFFF0\">Ivory<option value=\"#F0E68C\">Khaki<option value=\"#E6E6FA\">Lavender"+
"<option value=\"#FFF0F5\">LavenderBlush<option value=\"#7CFC00\">LawnGreen<option value=\"#FFFACD\">LemonChiffon<option value=\"#ADD8E6\">LightBlue"+
"<option value=\"#F08080\">LightCoral<option value=\"#E0FFFF\">LightCyan<option value=\"#FAFAD2\">LightGoldenRodYellow<option value=\"#D3D3D3\">LightGray"+
"<option value=\"#90EE90\">LightGreen<option value=\"#FFB6C1\">LightPink<option value=\"#FFA07A\">LightSalmon<option value=\"#20B2AA\">LightSeaGreen"+
"<option value=\"#87CEFA\">LightSkyBlue<option value=\"#778899\">LightSlateGray<option value=\"#B0C4DE\">LightSteelBlue<option value=\"#FFFFE0\">LightYellow"+
"<option value=\"#00FF00\">Lime<option value=\"#32CD32\">LimeGreen<option value=\"#FAF0E6\">Linen<option value=\"#FF00FF\">Magenta"+
"<option value=\"#800000\">Maroon<option value=\"#66CDAA\">MediumAquaMarine<option value=\"#0000CD\">MediumBlue<option value=\"#BA55D3\">MediumOrchid"+
"<option value=\"#9370D8\">MediumPurple<option value=\"#3CB371\">MediumSeaGreen<option value=\"#7B68EE\">MediumSlateBlue<option value=\"#00FA9A\">MediumSpringGreen"+
"<option value=\"#48D1CC\">MediumTurquoise<option value=\"#C71585\">MediumVioletRed<option value=\"#191970\">MidnightBlue<option value=\"#F5FFFA\">MintCream"+
"<option value=\"#FFE4E1\">MistyRose<option value=\"#FFE4B5\">Mocassin<option value=\"#FFDEAD\">NavajoWhite<option value=\"#000080\">Navy"+
"<option value=\"#FDF5E6\">OldLace<option value=\"#808000\">Olive<option value=\"#6B8E23\">OliveDrab<option value=\"#FFA500\">Orange"+
"<option value=\"#FF4500\">OrangeRed<option value=\"#EEE8AA\">PaleGoldenRod<option value=\"#98FB98\">PaleGreen<option value=\"#AFEEEE\">PaleTurquoise"+
"<option value=\"#D87093\">PaleVioletRed<option value=\"#FFEFD5\">PapayaWhip<option value=\"#FFDAB9\">PeachPuff<option value=\"#CD853F\">Peru"+
"<option value=\"#FFC0CB\">Pink<option value=\"#DDA0DD\">Plum<option value=\"#B0E0E6\">PowderBlue<option value=\"#800080\">Purple"+
"<option value=\"#FF0000\">Red<option value=\"#BC8F8F\">RosyBrown<option value=\"#4169E1\">RoyalBlue<option value=\"#8B4513\">SaddleBrown"+
"<option value=\"#FA8072\">Salmon<option value=\"#F4A460\">SandyBrown<option value=\"#2E8B57\">SeaGreen<option value=\"#FFF5EE\">SeaShell"+
"<option value=\"#A0522D\">Sienna<option value=\"#C0C0C0\">Silver<option value=\"#87CEEB\">SkyBlue<option value=\"#6A5ACD\">SlateBlue"+
"<option value=\"#708090\">SlateGray<option value=\"#FFFAFA\">Snow<option value=\"#00FF7F\">SpringGreen<option value=\"#4682B4\">SteelBlue"+
"<option value=\"#D2B48C\">Tan<option value=\"#008080\">Teal<option value=\"#D8BFD8\">Thistle<option value=\"#FF6347\">Tomato"+
"<option value=\"#40E0D0\">Turquoise<option value=\"#EE82EE\">Violet<option value=\"#F5DEB3\">Wheat<option value=\"#FFFFFF\">White"+
"<option value=\"#F5F5F5\">WhiteSmoke<option value=\"#FFFF00\">Yellow<option value=\"#9ACD32\">YellowGreen"+
"</select> "+
"<select name=\"fnt_face\" id=\"fnt_face\" onChange=\"javascript:COMMENTOR.insertTag('<span style=font-family:'+COMMENTOR.$('testimonial_form').fnt_face.options[fnt_face.selectedIndex].value+'>', '</span>'); COMMENTOR.$('testimonial_form').fnt_face.options[0].selected=true\">"+
"<option value=\"\">Jenis Teks"+
"<option value=\"Serif\" style=\"font-family:serif\">Serif"+
"<option value=\"Monospace\" style=\"font-family:monospace\">Monospace"+
"<option value=\"Century\" style=\"font-family:Century\">Century"+
"<option value=\"Tahoma\" style=\"font-family:Tahoma\">Tahoma"+
"<option value=\"Verdana\" style=\"font-family:Verdana\">Verdana"+
"<option value=\"Courier\" style=\"font-family:Courier\">Courier"+
"</select>"+
"</div>"+
"<table class=\"formtable\"><tr><td class=\"value\">"+
"<textarea id=\"komen\" rows=\"7\" style=\"width:"+COMMENTOR.$width+"\" name=\"body\" onKeyDown=\"textCounter(COMMENTOR.$('komen'),COMMENTOR.$('minputcount'),"+COMMENTOR.$max+");\" onKeyUp=\"textCounter(COMMENTOR.$('komen'),COMMENTOR.$('minputcount'),"+COMMENTOR.$max+");\"></textarea>"+
"<div style=\"width:"+COMMENTOR.$width+"\">"+
"<a href=\"javascript:void(0);\" onClick=\"COMMENTOR.rstxtbox('komen', 0, 10);\"><img alt=\"\" src=\"http://h1.ripway.com/feruzz/friendster/photo/rs_vb.gif\" style=\"margin: 2px\" /></a>"+
"<a href=\"javascript:void(0);\" onClick=\"COMMENTOR.rstxtbox('komen', 0, -10);\"><img alt=\"\" src=\"http://h1.ripway.com/feruzz/friendster/photo/rs_vs.gif\" style=\"margin: 2px\" /></a>"+
"</div>"+
"</td></tr><tr><td class=\"value\">"+
"<input style=\""+COMMENTOR.$insty+"\" type=\"button\" name=\"Submit\" href=\"#quickcomment\" onMouseOver=\"window.status='Send';return true;\" onClick=\"javascript:void(COMMENTOR.insertSM());COMMENTOR.$('testimonial_form').action='http://www.friendster.com/testimonials.php?uid="+pageOwnerID+""+COMMENTOR.$amp+"action=add';COMMENTOR.$('testimonial_form').submit();javascript:void(COMMENTOR.sendForm());\" value=\"Kirim\"> "+
"<input style=\""+COMMENTOR.$insty+"\" type=\"button\" value=\"Preview\" onclick=\"javascript:void(COMMENTOR.insertSM());javascript:void(COMMENTOR.togglecomprev(0));\"> "+
"<input style=\""+COMMENTOR.$insty+"\" class=\"clearButtons\" type=\"reset\" name=\"cancel\" value=\"Clear\" maxlength=\"25\"> "+
"<input style=\""+COMMENTOR.$insty+"\" class=\"closeButtons\" type=\"reset\" name=\"cancel\" onClick=\"javascript:void(COMMENTOR.cancelForm());\" value=\"Ga Jadi Komen\"> "+
"<input id=\"show\" style=\""+COMMENTOR.$insty+"\" class=\"Smilies\" type=\"button\" name=\"Smilies\" onClick=\"javascript:void(COMMENTOR.showForm());\" value=\"Pake Gambar\">"+
"<input id=\"close\" style=\"display:none;"+COMMENTOR.$insty+"\" class=\"Smilies\" type=\"button\" name=\"Smilies\" onClick=\"javascript:void(COMMENTOR.hideForm());\" value=\"Ga pake Gambar\">"+
"<div class=\"dc\"><span class=\"q\">Sisa Huruf </span><input id=\"minputcount\" readonly maxlength=\"4\" size=\"4\" value=\""+COMMENTOR.$max+"\" name=\"inputcount\"></div>"+
"<div id=\"hide\" style=\"display:none;width:"+COMMENTOR.$width+"\" align=\"center\">"+smdiv.innerHTML+"</div>"+
"</td></tr></table></form></div>";
COMMENTOR.commentBox("Ryo's Quick Comment Feature",commform,"quickcomment",/publiccomments/i,"above");
document.location.href="#quickcomment";
COMMENTOR.createcomprev();
},
togglecomprev: function(prevflag) {
var el = COMMENTOR.$("prevComment");
if (prevflag === 0) {
commCode1 = COMMENTOR.$("quickcomment").getElementsByTagName("textarea")[0].value.replace(/</g, "<").replace(/>/g, ">");
commCode2 = COMMENTOR.$("quickcomment").getElementsByTagName("textarea")[0].innerHTML.replace(/</g, "<").replace(/>/g, ">");
if (commCode1 !== "") {
el = COMMENTOR.replaceHtml(el,commCode1);
}else {
el = COMMENTOR.replaceHtml(el,commCode2);
}
COMMENTOR.$("commentprevbox").style.display = "";
}else {
COMMENTOR.changeText(el,"");
COMMENTOR.$("commentprevbox").style.display = "none";
}
},
createcomprev: function() {
try {
var prevBox = document.createElement("div");
prevBox.id = "commentprevbox";
prevBox.style.display = "none";
prevBox.style.padding = "15px";
prevBox.appendChild(document.createElement("div"));
prevBox.getElementsByTagName("div")[0].id = "prevComment";
prevBox.getElementsByTagName("div")[0].style.padding = "5px";
prevBox.getElementsByTagName("div")[0].style.border = "thin";
prevBox.getElementsByTagName("div")[0].style.borderStyle = "solid";
prevBox.appendChild(document.createElement("div"));
prevBox.getElementsByTagName("div")[1].align = "center";
prevBox.getElementsByTagName("div")[1].style.padding = "5px";
var cbutton = document.createElement("input");
cbutton.style.padding = "4px 0";
cbutton.style.margin = "10px 0 6px 0";
cbutton.style.fontFamily = "tahoma";
cbutton.style.fontWeight = "bold";
cbutton.style.color = "#ffffff";
cbutton.style.border = "1px solid #ffffff";
cbutton.style.backgroundColor = "transparent";
cbutton.type = "button";
cbutton.value = "Hide Preview";
cbutton.onclick = function() {
COMMENTOR.togglecomprev(1);
};
prevBox.getElementsByTagName("div")[1].appendChild(cbutton);
COMMENTOR.$("quickcomment").appendChild(prevBox);
}catch(e) {
COMMENTOR.createcomprev();
}
},
hideStatus: function() {
try {
sty = document.createElement("style");
sty.type = "text/css";
COMMENTOR.changeText(sty,".statusmessagebox{display:none;}.postimage{cursor:hand;}.postimage:hover{background-color:#C2CFE5;cursor:hand;}");
document.getElementsByTagName("head")[0].appendChild(sty);
}catch(e){}
try {
document.styleSheets[document.styleSheets.length - 1].addRule(".statusmessagebox", "display:none;");
document.styleSheets[document.styleSheets.length - 1].addRule(".postimage", "cursor:pointer;cursor:hand;");
document.styleSheets[document.styleSheets.length - 1].addRule(".postimage:hover", "background-color:#C2CFE5;cursor:pointer;cursor:hand;");
}catch(e){}
},
sendForm: function() {
COMMENTOR.changeText(COMMENTOR.$("quickcomment").getElementsByTagName("h2")[0],"lagi ngirim comment-nya....bentar ya!");
var postComment = document.createElement("div");
postComment.className = "boxcontent";
postComment.align = "center";
postComment.appendChild(document.createElement("img"));
postComment.getElementsByTagName("img")[0].src = "http://www.photo-host.org/img/239795loading.gif";
if (COMMENTOR.$("content_quickcomment") !== null) {
COMMENTOR.$("content_quickcomment").parentNode.replaceChild(postComment,COMMENTOR.$("content_quickcomment"));
}
COMMENTOR.$("commentprevbox").parentNode.removeChild(COMMENTOR.$("commentprevbox"));
document.location.href="#quickcomment";
},
cancelForm: function() {
setTimeout("COMMENTOR.$('quickcomment').parentNode.removeChild(COMMENTOR.$('quickcomment'));document.location.href='#18'",2000);
COMMENTOR.init();
},
showForm: function() {
if (COMMENTOR.$("hide").style.display != "none") {
COMMENTOR.hideForm();
}else {
COMMENTOR.$("hide").style.display = "";
COMMENTOR.$("show").style.display = "none";
COMMENTOR.$("close").style.display = "";
}
},
hideForm: function() {
COMMENTOR.$("hide").style.display = "none";
COMMENTOR.$("show").style.display = "";
COMMENTOR.$("close").style.display = "none";
},
insertSM: function() {
var allsmileys = COMMENTOR.$("komen").value.match(/:
\w+)?::/gim);
if (allsmileys !== null) {
for(sm=0;sm<allsmileys.length;sm++) {
if (smileys[allsmileys[sm].match(/\w+/)[0]] !== "undefined") {
COMMENTOR.$("komen").value = COMMENTOR.$("komen").value.replace(/:
\w+)?::/gim, "<img src=\""+smileys[allsmileys[sm].match(/\w+/)[0]]+"\" border=\"0\">");
}
}
}
},
//faster than innerHTML
replaceHtml: function(el, html) {
var oldEl = typeof el === "string" ? COMMENTOR.$(el) : el;
/*@cc_on
oldEl.innerHTML = html;
return oldEl;
@*/
var newEl = oldEl.cloneNode(false);
newEl.innerHTML = html;
oldEl.parentNode.replaceChild(newEl, oldEl);
return newEl;
},
innerTextFeature: function() {
var obj = (document.getElementsByTagName("body")[0].innerText !== undefined) ? true : false;
return obj;
},
changeText: function(elem,changeVal) {
if(!COMMENTOR.innerTextFeature()) {
elem.textContent = changeVal;
}else {
elem.innerText = changeVal;
}
},
rtxt: function(text,textarea) {
if (typeof(textarea.caretPos) != "undefined" && textarea.createTextRange) {
var caretPos = textarea.caretPos;
caretPos.text = caretPos.text.charAt(caretPos.text.length-1) == " "? text+" ": text;
caretPos.select();
}else if(typeof(textarea.selectionStart) != "undefined") {
var begin = textarea.value.substr(0,textarea.selectionStart);
var end = textarea.value.substr(textarea.selectionEnd);
var scrollPos = textarea.scrollTop;textarea.value = begin+text+end;
if (textarea.setSelectionRange) {
textarea.focus();
textarea.setSelectionRange(begin.length+text.length,begin.length+text.length);
}
textarea.scrollTop = scrollPos;
}else {
textarea.value += text;
textarea.focus(textarea.value.length-1);
}
},
insertTag: function(open, close) {
msgfield = (document.all) ? document.all.body : COMMENTOR.$('testimonial_form').body;
if (document.selection && document.selection.createRange) {
msgfield.focus();
sel = document.selection.createRange();
sel.text = open + sel.text + close;
msgfield.focus();
}else if (msgfield.selectionStart || msgfield.selectionStart == '0') {
var startPos = msgfield.selectionStart;
var endPos = msgfield.selectionEnd;
msgfield.value = msgfield.value.substring(0, startPos) + open + msgfield.value.substring(startPos, endPos) + close + msgfield.value.substring(endPos, msgfield.value.length);
msgfield.selectionStart = msgfield.selectionEnd = endPos + open.length + close.length;
msgfield.focus();
}else {
msgfield.value += open + close;
msgfield.focus();
}
return;
},
//Expand the textarea
rstxtbox: function(name, colInc, rowInc) {
try {
var objek;
if (COMMENTOR.$IE4) {
objek = document.all[name];
}else {
objek = COMMENTOR.$(name);
}
objek.rows += rowInc;
objek.cols += colInc;
}catch(e) {}
},
$: function(id) {
if (COMMENTOR.$DOM) return document.getElementById(id);
return (COMMENTOR.$NS4) ? document.layers[id] : (COMMENTOR.$IE4) ? document.all[id] : (COMMENTOR.$IE5||COMMENTOR.$NS5) ? document.getElementById(id) : null;
},
commentBox: function(head,code,id,sibling,x) {
var sbdiv = document.createElement("div");
sbdiv.className="commonbox "+id;
sbdiv.id = id;
if (!head) head = "";
else head = "<h2>"+head+"</h2>";
sbdiv.innerHTML = head;
sbdiv.appendChild(document.createElement("div"));
sbdiv.getElementsByTagName("div")[0].id = "content_"+id;
sbdiv.getElementsByTagName("div")[0].innerHTML = code;
var sbli = document.createElement("li");
sbli.appendChild(sbdiv);
if (!x) this.getModuleByClassName(sibling)[0].parentNode.parentNode.appendChild(sbli);
else if (x == "below") this.getModuleByClassName(sibling)[0].parentNode.appendChild(sbli);
else if (x == "above") {
var ul = this.getModuleByClassName(sibling)[0];
ul.parentNode.parentNode.insertBefore(sbli,ul.parentNode);
}
},
getModuleByClassName: function(sClass) {
var elm = [];
var els = document.getElementsByTagName("*") || document.all;
for (var j=0,k=els.length;j<k;j++) {
if (new RegExp(sClass).test(els[j].className))elm.push(els[j]);
}
return elm;
}
};[/spoiler]
script diatas adalah script untuk quick comment