CINXE.COM

Campaign Wiki LinksToWisdom: Editing Alex

<!DOCTYPE html> <html><head><title>Campaign Wiki LinksToWisdom: Editing Alex</title><link type="text/css" rel="stylesheet" href="https://campaignwiki.org/default.css" /><meta name="robots" content="NOINDEX,FOLLOW" /><link rel="alternate" type="application/rss+xml" title="Campaign Wiki LinksToWisdom" href="https://campaignwiki.org/wiki/LinksToWisdom?action=rss" /><link rel="alternate" type="application/rss+xml" title="Campaign Wiki LinksToWisdom: Alex" href="https://campaignwiki.org/wiki/LinksToWisdom?action=rss;rcidonly=Alex" /> <script type="text/Javascript"> function togglecomments (id) { var elem = document.getElementById(id); if (elem.className=="commentshown") { elem.className="commenthidden"; } else { elem.className="commentshown"; } } </script> <script type="text/javascript"> if (!HTMLTextAreaElement.prototype.insertAtCaret) { HTMLTextAreaElement.prototype.insertAtPoint = function (text) { text = text || ''; if (this.selectionStart || this.selectionStart === 0) { // Others var startPos = this.selectionStart; var endPos = this.selectionEnd; this.value = this.value.substring(0, startPos) + text + this.value.substring(endPos, this.value.length); this.selectionStart = startPos + text.length; this.selectionEnd = startPos + text.length; } else { this.value += text; } }; }; var PasteImage = { init: function() { let e = document.getElementById('text') || document.getElementById('aftertext'); if (e) e.addEventListener('paste', PasteImage.handler); }, handler: function(e) { // Chrome if (e.clipboardData) { let items = e.clipboardData.items; for (var i = 0; i < items.length; i++) { if (items[i].type.indexOf("image") !== -1) { let blob = items[i].getAsFile(); let reader = new window.FileReader(); reader.onloadend = function() { let dataUrl = reader.result; let n = 1; while (n++ < 4 && 2048000 > 0 && dataUrl.length > 2048000) dataUrl = PasteImage.shrink(dataUrl); PasteImage.process(dataUrl, "Image_{n}_for_Alex", "Image {n}", 1); } reader.readAsDataURL(blob); } } } }, shrink: function(dataUrl) { let image = new Image; image.src = dataUrl; let canvas = document.createElement("canvas"); canvas.width = image.width; canvas.height = image.height; let ctx = canvas.getContext("2d"); ctx.drawImage(image, 0, 0); let width_source = canvas.width; let height_source = canvas.height; let width = Math.round(width_source * 0.5); let height = Math.round(height_source * 0.5); let ratio_w = width_source / width; let ratio_h = height_source / height; let ratio_w_half = Math.ceil(ratio_w / 2); let ratio_h_half = Math.ceil(ratio_h / 2); let img = ctx.getImageData(0, 0, width_source, height_source); let img2 = ctx.createImageData(width, height); let data = img.data; let data2 = img2.data; for (let j = 0; j < height; j++) { for (let i = 0; i < width; i++) { let x2 = (i + j * width) * 4; let weight = 0; let weights = 0; let weights_alpha = 0; let gx_r = 0; let gx_g = 0; let gx_b = 0; let gx_a = 0; let center_y = (j + 0.5) * ratio_h; let yy_start = Math.floor(j * ratio_h); let yy_stop = Math.ceil((j + 1) * ratio_h); for (let yy = yy_start; yy < yy_stop; yy++) { let dy = Math.abs(center_y - (yy + 0.5)) / ratio_h_half; let center_x = (i + 0.5) * ratio_w; let w0 = dy * dy; //pre-calc part of w let xx_start = Math.floor(i * ratio_w); let xx_stop = Math.ceil((i + 1) * ratio_w); for (let xx = xx_start; xx < xx_stop; xx++) { let dx = Math.abs(center_x - (xx + 0.5)) / ratio_w_half; let w = Math.sqrt(w0 + dx * dx); if (w >= 1) { //pixel too far continue; } //hermite filter weight = 2 * w * w * w - 3 * w * w + 1; let pos_x = 4 * (xx + yy * width_source); //alpha gx_a += weight * data[pos_x + 3]; weights_alpha += weight; //colors if (data[pos_x + 3] < 255) weight = weight * data[pos_x + 3] / 250; gx_r += weight * data[pos_x]; gx_g += weight * data[pos_x + 1]; gx_b += weight * data[pos_x + 2]; weights += weight; } } data2[x2] = gx_r / weights; data2[x2 + 1] = gx_g / weights; data2[x2 + 2] = gx_b / weights; data2[x2 + 3] = gx_a / weights_alpha; } } canvas.width = width; canvas.height = height; ctx.putImageData(img2, 0, 0); let png = canvas.toDataURL(); let jpg = canvas.toDataURL('image/jpeg'); return png <= jpg ? png : jpg; }, process: function(dataUrl, templatePage, templateText, n) { let name = templatePage.replace('{n}', n); let text = templateText.replace('{n}', n); let xhr = new XMLHttpRequest(); xhr.open("HEAD", "https://campaignwiki.org/wiki/LinksToWisdom/" + name, true); xhr.onreadystatechange = function() { if (xhr.readyState == 4) { if (xhr.status == 200) { PasteImage.process(dataUrl, templatePage, templateText, n+1); } else if (xhr.status == 404) { PasteImage.post(dataUrl, name, text); } else { let re = /<h1>(.*)<\/h1>/g; let match = re.exec(xhr.responseText); alert(match[1]); } } }; xhr.send(null); }, post: function(dataUrl, name, text) { let xhr = new XMLHttpRequest(); xhr.open("POST", "https://campaignwiki.org/wiki/LinksToWisdom", true); xhr.onreadystatechange = function() { if (xhr.readyState == 4) { if (xhr.status == 200) { let e = document.getElementById('text') || document.getElementById('aftertext'); e.insertAtPoint("[[image:" + name + "|" + text + "]]"); } else { let re = /<h1>(.*)<\/h1>/g; let match = re.exec(xhr.responseText); alert(match[1]); } } } let mimeType = dataUrl.split(',')[0].split(':')[1].split(';')[0]; let content = encodeURIComponent(dataUrl.split(',')[1]); let params = "title=" + encodeURIComponent(name); params += "&summary=" + encodeURIComponent(name); params += "&username=" + encodeURIComponent(""); params += "&recent_edit=on"; params += "&frodo=1"; params += "&text=#FILE " + mimeType + "%0A" + content; xhr.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); xhr.send(params); }, }; window.addEventListener('load', PasteImage.init); </script> <link href="https://campaignwiki.org/wiki/LinksToWisdom?action=journal" rel="alternate" title="Campaign Wiki LinksToWisdom: News" type="application/rss+xml" /><meta content="telephone=no" name="format-detection" /><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /></head><body ontouchstart="" class="default" lang="en"><header><a class="logo" href="https://campaignwiki.org/wiki/LinksToWisdom/HomePage"><img alt="[Home]" class="logo" src="https://campaignwiki.org/pics/LinksToWisdom/Logo.jpg " /></a><nav><span class="gotobar bar"><a class="local" href="https://campaignwiki.org/wiki/LinksToWisdom/HomePage">HomePage</a> <a class="local" href="https://campaignwiki.org/wiki/LinksToWisdom/RecentChanges">RecentChanges</a> <a class="local" href="https://campaignwiki.org/wiki/LinksToWisdom/About">About</a> <a class="url http" href="http://campaignwiki.org/add-link">New</a> <a class="url http" href="http://osrsearch.blogspot.com/">OSR Search</a></span><form method="get" action="https://campaignwiki.org/wiki/LinksToWisdom" enctype="multipart/form-data" accept-charset="utf-8" class="search"><p class="search"><span class="search"><label for="search">Search:</label> <input type="text" name="search" size="15" accesskey="f" id="search" /></span> <span class="match"><label for="matchingpage">Find Page:</label> <input type="text" name="match" size="15" id="matchingpage" /></span> <input type="submit" name="dosearch" value="Go!" /></p></form></nav><h1>Editing Alex</h1></header><div class="wrapper"><div class="content edit"><form method="post" action="https://campaignwiki.org/wiki/LinksToWisdom" enctype="multipart/form-data" accept-charset="utf-8" class="edit text"><p><input name="title" type="hidden" value="Alex" /> <input name="oldtime" type="hidden" value="1410338981" /> <textarea name="text" rows="25" cols="78" id="text">I have a [http://alexschroeder.ch/wiki/ blog] with an [http://alexschroeder.ch/wiki/RPG RPG category]. I also run this site, so if you have a question regarding the site, don&#39;t hesitate to [mailto:kensanata@gmail.com contact me via email]. </textarea></p><p>Summary:<br /><textarea name="summary" rows="2" cols="78" id="summary"></textarea></p><p><label><input type="checkbox" name="recent_edit" value="on" />This change is a minor edit.</label></p><p>See <a href="https://campaignwiki.org/wiki/Info">Info</a> for markup rules.</p><div class="question"><p>To save this page you must answer this question:</p> <blockquote><p>Please say HELLO.</p> <p><input name="answer" type="text" /> <input name="question_num" type="hidden" value="0" /> </p></blockquote></div><p><label for="username">Username:</label> <input type="text" name="username" size="20" maxlength="50" id="username" /></p><p><input type="submit" name="Save" value="Save" accesskey="s" /> <input type="submit" name="Preview" value="Preview" accesskey="p" /> <input type="submit" name="Cancel" value="Cancel" /></p><p><a class="upload" href="https://campaignwiki.org/wiki/LinksToWisdom?action=edit;upload=1;id=Alex" rel="nofollow">Replace this text with a file</a></p><div><input type="hidden" name=".cgifields" value="recent_edit" /></div> </form></div><div class="wrapper close"></div></div><footer><hr /><div class="edit bar"><a class="history" href="https://campaignwiki.org/wiki/LinksToWisdom?action=history;id=Alex" rel="nofollow">View other revisions</a> <a class="local" href="https://campaignwiki.org/wiki/LinksToWisdom/Alex">View current revision</a> <a class="rc" href="https://campaignwiki.org/wiki/LinksToWisdom?action=rc;all=1;from=1;showedit=1;rcidonly=Alex" rel="nofollow">View all changes</a> <a class="admin" href="https://campaignwiki.org/wiki/LinksToWisdom?action=admin;id=Alex" rel="nofollow">Administration</a></div><p>See <a class="local" href="https://campaignwiki.org/wiki/LinksToWisdom/Site_License">Site License</a> for licensing information.</p></footer> </body> </html>

Pages: 1 2 3 4 5 6 7 8 9 10