User:GeorgeMoney/UserScripts/savecookie

// //COOKIE SAVING

function changemsg(msg,color) { if(!color) { var color = 'green'; } var txtr = "editsts"; var div = document.getElementById(txtr); div.innerHTML = ''+msg+' ';

}

if (window.location.href.indexOf('action=edit') != -1 || window.location.href.indexOf('action=submit') != -1) {

addOnloadHook(function{

s='\n\n\n '; s+=' 4038) { changemsg(\'Cannot save to cookie. Reason: Page size too large to be saved in cookie, sorry! It must be below 4038 characters in length, and your text is \'+escape(document.getElementById(\'wpTextbox1\').value).length+\' characters, which is \'+ (escape(document.getElementById(\'wpTextbox1\').value).length - 4038) + \' characters too many!\', \'red\'); alert(\'Error! Page size too large to be saved in cookie, sorry! It must be below 4038 characters in length, and your text is \'+escape(document.getElementById(\'wpTextbox1\').value).length+\' characters, which is \'+ (escape(document.getElementById(\'wpTextbox1\').value).length - 4038) + \' characters too many! \'); } else { createCookie(\'SAVEDWIKIPAGE-'+wgPageName+'\', escape(document.getElementById(\'wpTextbox1\').value), 365); changemsg(\'Cookie saved!\'); }" value="save to cookie" />&emsp;&emsp;\n'; s+=''; s+='\n'; s+='&emsp; 4038) { var extra = \'Which is too large to save into a cookie. Cookies can only handle 4038 characters. You have \' + (escape(document.getElementById(\'wpTextbox1\').value).length - 4038) + \' characters more than the limit. \'; } else { var extra = \'\'; } var msg = \'Characters in editbox (after converted to cookie encoded form): \'+ escape(document.getElementById(\'wpTextbox1\').value).length + \' characters. \'+extra; changemsg(msg); " />\n'; s+=' \n'; var divs = document.getElementsByTagName('div'); for (i=0; i<divs.length; i++) { if (divs[i].className == 'editButtons') { divs[i].innerHTML = s;	  } }

});

}

//END

//