// ==UserScript== // @id GAF-QQRE // @name NeoGAF: Quick Quote, Reply, and Edit (modified by Sharkiller) // @namespace hateradio // @author hateradio (modified by Sharkiller) // @version 8 // @description This script adds the ability to quickly quote, reply, and edit posts on NeoGAF. Just click and go. // @homepage https://greasyfork.org/scripts/1022-neogaf-quick-quote-reply-and-edit // @icon data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAA2RpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMC1jMDYwIDYxLjEzNDc3NywgMjAxMC8wMi8xMi0xNzozMjowMCAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iIHhtbG5zOnN0UmVmPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VSZWYjIiB4bWxuczp4bXA9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8iIHhtcE1NOk9yaWdpbmFsRG9jdW1lbnRJRD0ieG1wLmRpZDpGRjg5NTBEMDYwODdFMDExQkE4RUNGOEQ3QzZENjU2MyIgeG1wTU06RG9jdW1lbnRJRD0ieG1wLmRpZDo1NzUyNDZBRTg3RDkxMUUwQkE0Q0QyRjcyMEQwQUNDOCIgeG1wTU06SW5zdGFuY2VJRD0ie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ZmOgDUoZ5EqZ8+rudYq1p0hD8zXSwpQfm7+pGBemh+mkM11aOo+qH0bACoQz2MTXE0ciSwSF6kRIcSTP2YcYIjx1HEVO/eFkNgW6oElwBYAmD+ssbSf49f5cf/BBgAlKO7u4jI694AAAAASUVORK5CYII= // @screenshot https://dl.dropboxusercontent.com/u/14626536/userscripts/updt/qqre/qqre_08.png // @include http://*neogaf.com/forum/showthread.php?* // @include http://*neogaf.com/forum/newreply.php* // @include http://*neogaf.com/forum/editpost.php* // @include http://*neogaf.com/forum/newthread.php* // @include http://*neogaf.com/forum/subscription.php* // @include http://*neogaf.com/forum/showpost.php* // @include http://*neogaf.com/forum/private.php* // @match http://*.neogaf.com/forum/showthread.php?* // @match http://*.neogaf.com/forum/newreply.php* // @match http://*.neogaf.com/forum/editpost.php* // @match http://*.neogaf.com/forum/newthread.php* // @match http://*.neogaf.com/forum/subscription.php* // @match http://*.neogaf.com/forum/showpost.php* // @match http://*.neogaf.com/forum/private.php* // @updated 28 MAY 2014 // @since 30 OCT 2010 // @grant GM_xmlhttpRequest // (c) 2010+, hateradio // @downloadURL none // ==/UserScript== /* Changes ## Version 8 * **New**: Emoji picker! * **New**: (Windows) Emoji support to Chrome-based browsers! * - _Note 1_: Segoe UI Symbol, Segoe UI Emoji and Symbola added to the font list * - _Note 2_: This may change default fonts a bit * - _Note 3_: Windows 7 users who have issues displaying Emoji should install [Symbola](http://users.teilar.gr/~g1951d/) * **New**: USC-2 decoder and entity encoder to work with forum AJAX to transmit Emoji data * **Fix**: Removing recursive quotes no longer causes an error 7.4.1
' : '[indent]', '[^]+?([^]+?)<\\/pre>[^]+?<\\/blockquote>' : '[code]$1[/code]', // '[^]+?<\\/blockquote>' : '', // '[^]+?([^]+?)[^]+?<\\/p>([^]+?)<\\/blockquote>' // '' : '', // inner quotes are going to get buggy '<\\/blockquote>' : '[/indent]', '' : '[*]', '<\\/li>' : '', '' : '[b]', '<\\/b>' : '[/b]', '' : '[i]', '<\\/i>' : '[/i]', ' ' : '[strike]', '<\\/strike>' : '[/strike]', '' : '[u]', '<\\/u>' : '[/u]', '' : '[list]', '<\\/ul>' : '[/list]\n', '
' : '[list=1]', '<\\/ol>' : '[/list]\n', '
' : '', '
' : '[img]$1[/img]', '([^]+?)<\\/a>' : '[email="$1"]$2[/email]', // '[^]+?<\\/a>' : '', '' : '[url="$1"]', '' : '[/url]', // '
([^]+?)<\\/pre[^]+?<\\/div>' : '[code]$1[/code]\n', '([^]+?)<\\/span>' : '$1', '([^]+?)<\\/span>' : '[spoiler]$1[/spoiler]', '([^]+?)<\\/span>' : '[highlight]$1[/highlight]', '' : '', '' : '', ' ' : '', '<.*?>' : '', '\\[I\'m an idiot\\.\\]' : 'lol' }, // '' : ':lol', // '
' : ':D', e: ['removeformat', 1, 'undo', 'redo', 1, 'bold', 'italic', 'underline', 1, 'insertorderedlist', 'insertunorderedlist', 'outdent', 'indent', 1, 'createlink', 'unlink', 'email', 'insertimage', 1, 'quote', 'code', 1, 2], token: function () { var s = greaseWindow.SECURITYTOKEN; return typeof s === 'string' ? s : ''; }, tokenFromPage: function () { try { if (!!document.querySelector('#usercptools strong')) { return document.getElementsByTagName('head')[0].textContent.match(/SECURITYTOKEN = "(.+?)"/)[1]; } return ''; } catch (e) { /*alert('Quick Quote, Reply and Edit encountered an error.'); */ } }, store: function () { var i = this.usp.getElementsByTagName('input'), j = i.length, k; if (strg.zero(this.userSettings)) { this.set(); } if (this.userSettings.i === this.tid) { this.write(); }//console.log('This has tid:'+this.userSettings.i+' title:'+this.userSettings.t/* +' content:'+this.userSettings.c */+' u:'+this.userSettings.u+' s:'+this.userSettings.s); this.iur.checked = this.userSettings.u; this.sav.addEventListener('click', this.set, false); this.del.addEventListener('click', this.rem, false); this.frm.addEventListener('submit', this.rem, false); this.iur.addEventListener('click', this.set, false); while (j--) { k = i[j]; if (+k.value === +this.userSettings.s) { k.checked = true; } k.addEventListener('click', this.set, false); } }, write: function () {// console.log('write STOREd'); this.qtl.value = this.userSettings.t; this.txt.value = this.userSettings.c; }, rem: function () { if (this.value === 'Delete') { helper.qtl.value = helper.txt.value = ''; } helper.userSettings = {i: 0, t: '', c: '', u: helper.iur.checked, s: helper.sub}; strg.save(helper.key, helper.userSettings); }, toggleImageQuotes: function (e) { if (e.altKey && String.fromCharCode(e.which).toLowerCase() === 't') { e.preventDefault(); if (e.type === 'keypress') { return; } Extra.prototype.click(helper.iur); alert('Note: Images in quotes ' + (helper.iur.checked ? 'disabled.' : 'enabled.')); } }, set: function (e) { if (e && e.target.name === 'emailupdate') { helper.sub = e.target.value; } helper.userSettings = {i: helper.tid, t: helper.qtl.value, c: helper.txt.value, u: helper.iur.checked, s: helper.sub}; strg.save(helper.key, helper.userSettings);// console.log('i: '+helper.userSettings.i+' t: '+helper.userSettings.t+' u: '+helper.userSettings.u+' s: '+helper.userSettings.s); // console.log('c: '+helper.userSettings.c); }, buster: function () { update.js('function vhook(id){ return vB_Editor["vB_Editor_"+id] = new vB_Text_Editor("vB_Editor_"+id, 0, "3", "1"); } (function(){ vbphrase["enter_list_item"] = "Enter a list item."; vbphrase["message_too_short"] = "Your message is too short."; vbphrase["enter_link_url"] = "URL:"; vbphrase["enter_image_url"] = "Image URL:"; vbphrase["enter_email_link"] = "E-mail:"; }())'); var s = $.e('script', {type: 'text/javascript', src: '/forum/clientscript/vbulletin_textedit.js' + helper.ver}); s.addEventListener('load', function () { update.js('(function () { vhook("001"); }())'); }, false); document.body.appendChild(s); }, ids: function () { try { this.tid = document.querySelector('.left a[href*="showthread.php?t="]').href.match(/t\=(\d+)/)[1]; this.pid = document.querySelector('a[href^="newreply.php?do=newreply&noquote=1&p="]').href.match(/p\=(\d+)/)[1]; } catch (e) {} return (this.tid && this.pid); }, form: function () { if (!this.main || !this.ids()) { return false; } return this.makeForm('001', this.main); }, makeForm: function (n, el, msg, title, edit, reason) { if (!n || !el) { return false; } msg = $.h(msg || ''); title = $.h(title || ''); reason = $.h(reason || ''); var i = -1, j = helper.e.length, f = $.e('form', {className: 'quickreplyformp', action: n === '001' ? 'newreply.php' : 'editpost.php', name: 'vbform', method: 'post', onsubmit: 'return vB_Editor["vB_Editor_' + n + '"].prepare_submit(0, 1)'}, el), d = $.e('div', {className: n === '001' ? 'alt1 newreplybox' : 'alt2 newreplybox'}, f), p = $.e('p', false, d), v = $.e('div', {id: 'vB_Editor_' + n, className: 'vBulletin_editor'}, d), w = $.e('div', {id: 'vB_Editor_' + n + '_controls', className: 'controlbar'}, v), container = $.e('div', {innerHTML: '
'}, d), t = $.e('textarea', {dir: 'ltr', tabindex: 2, cols: 60, rows: 10, _width: '98%', _height: '150px', id: 'vB_Editor_' + n + '_textarea', name: 'message', value: msg}), r = $.e('div', {$style: 'text-align:center;margin-top:6px;clear:both'}, d), ti = $.e('input', {size: 50, name: 'title', className: 'biginput', type: 'text', tabindex: 1, value: title}, p); container.querySelector('.text_emo_container_text').appendChild(t); emoji.make(container.querySelector('.text_emo_container_emo'), t); if (!edit) { $.e('small', {title: 'Optionally, set a title for your post.', _cursor: 'help', textContent: ' Title'}, p); } else { ti.parentNode.removeChild(ti); $.e('input', {className: 'biginput', type: 'text', title: 'Optional', maxlength: 125, size: 50, name: 'reason', value: reason}, p); $.e('small', {title: 'Reason for editing.', _cursor: 'help', textContent: ' Reason'}, p); } $.e('input', {type: 'hidden', name: 'securitytoken', id: '', value: this.token()}, r); $.e('input', {type: 'hidden', name: 'wysiwyg', id: '', value: 0}, r); $.e('input', {type: 'hidden', name: 's', value: ''}, r); $.e('input', {type: 'hidden', name: 'do', value: n === '001' ? 'postreply' : 'updatepost'}, r); $.e('input', {type: 'hidden', name: 't', value: helper.tid}, r); $.e('input', {type: 'hidden', name: 'p', value: n === '001' ? helper.pid : n}, r); $.e('input', {type: 'hidden', name: 'posthash', value: ''}, r); $.e('input', {type: 'hidden', name: 'poststarttime', value: ''}, r); $.e('input', {type: 'hidden', name: 'parseurl', value: 1}, r); $.e('input', {type: 'submit', name: 'sbutton', value: 'Submit', id: 'vB_Editor_' + n + '_save', className: 'large-button submit', tabindex: 3, accesskey: 's', title: 'Submit your reply.'}, r); if (n === '001') { this.frm = f; this.qtl = ti; this.sav = $.e('input', {type: 'button', name: 'sbutton1', value: 'Save', id: 'quicksavebutton', className: 'large-button submit', tabindex: 4, title: 'Save your reply.'}, r); this.del = $.e('input', {type: 'button', name: 'sbutton2', value: 'Delete', id: 'quickclearbutton', className: 'large-button submit', tabindex: 5, title: 'Delete your reply.'}, r); this.tmp = this.txt = t; } if (edit) { $.e('input', {type: 'button', name: 'cancel', value: 'Cancel', className: 'large-button submit cancel_button', tabindex: 6, accesskey: 'c', title: 'Cancel your reply.'}, r); } this.prevB = $.e('input', {type: 'submit', name: 'preview', value: 'Preview', className: 'large-button submit', tabindex: 7, accesskey: 'p', title: 'Preview your reply.'}, r); if (n === '001') {helper.usp = $.e('p', {id: 'qqre_subs', innerHTML: 'Subscribe? '}, r); } p = $.e('label', {'for': 'qqre_img', textContent: 'When quoting, auto-convert IMG tags to URL tags (ALT+T).', title: 'Convert [IMG] to [URL]', id: 'qqre_labelimg2url'}, r); p = $.e('input', {type: 'checkbox', id: 'qqre_img', checked: helper.userSettings ? helper.userSettings.u : false}, p); if (!this.iur) { this.iur = p; } $.e('div', {innerHTML: 'View CTRL-Key Shortcuts
'}, d); while (++i < j) { this.imgb(n, helper.e[i], w); } return true; }, imgb: function (n, m, el) { var id; switch (m) { case 1: $.e('img', {width: 6, height: 20, alt: '', src: 'images/neogaf/editor/separator.gif'}, $.e('div', false, el)); break; case 2: $.a($.e('div', {className: 'imagebutton resize_merger'}, el), $.e('div', {className: 'imagebutton', id: 'vB_Editor_' + n + '_cmd_resize_0_100'}, $.e('img', {src: 'images/neogaf/editor/resize_0.gif', height: 9, width: 21, alt: 'Decrease Size'}), true), $.e('div', {className: 'imagebutton', id: 'vB_Editor_' + n + '_cmd_resize_1_100'}, $.e('img', {src: 'images/neogaf/editor/resize_1.gif', width: 21, height: 9, alt: 'Increase Size'}), true)); break; case 'quote': case 'code': id = 'vB_Editor_' + n + '_cmd_wrap0_'; break; default: id = 'vB_Editor_' + n + '_cmd_'; break; } if (id) { $.e('img', {src: 'images/neogaf/editor/' + m + '.gif', width: 21, height: 20, alt: m}, $.e('div', {className: 'imagebutton', id: id + m}, el)); } }, reply: { put : function (post) { if (helper.userSettings.u) { post = post.replace(/\[url\=\".+?\"\]\[img\]/ig, function ($1) { return $1.replace(/\[img\]/i, 'Link[/url] : [url="'); }).replace(/\[\/img\]\[\/url/ig, '"]Image[/url').replace(/(?:\[(\/?)img\])/ig, '[$1url]'); } helper.tmp.value = helper.tmp.value ? (helper.tmp.value + '\n\n' + post) : post; //if (helper.tmp.id === helper.txt.id) { helper.set(); } }, quote : function () { var user = this.getAttribute('data-user'), id = this.id.substring(2), pid = this.id.substring(15), i, re, post = helper.reply.unquote(document.getElementById(id).innerHTML), r = helper.r; for (i in r) { if (r.hasOwnProperty(i)) { re = new RegExp(i, 'ig'); post = post.replace(re, r[i]); } } post = '[quote=' + user + ';' + pid + ']' + $.h(post).trim() + '[/quote]\n'; helper.reply.put(post); this.className = 'multiquotelink quickquotes quickquoted'; }, unquote: function (post) { var div = $.e('div', {innerHTML: post}), e = div.querySelectorAll('.quote:not(.code)'), i = e.length; while (i--) { try { div.removeChild(e[i]); } catch (er) {} } return div.innerHTML; } }, posts: function () { var i = document.querySelectorAll('.postbit:not(.ignored) .post').length; var p = document.querySelectorAll('.postbit:not(.ignored) .post'); var u = document.querySelectorAll('.postbit:not(.ignored) .postbit-details-username a'); var V = (document.querySelectorAll('.postbit:not(.ignored) .multiquotelink:not(.quickquotes)') || document.querySelectorAll('.postbit:not(.ignored) .post-button')), v, Y; while (i--) { v = V[i]; if (v && this.quickreply && v.parentNode.querySelector('.quickquotes') === null) { Y = $.e('i', {title: 'Quick Quote', '$data-user': u[i].textContent, id: 'q_' + p[i].id, className: 'multiquotelink quickquotes'}); Y.addEventListener('click', helper.reply.quote, false); v.parentNode.insertBefore(Y, v.parentNode.firstElementChild); } } }, go: function () { if (this.ran) { return false; } this.ran = true; if (document.location.href.match(/(?:\b(?:newreply|newpm|editpost|newthread)\b)/)) { return this.singleEdit(); } // console.log(this.token()); if (/(?:showthread)/.test(document.location.href) && this.token()) { return this.processPosts(false); } }, singleEdit: function () { var t = document.querySelector('td.controlbar'), a = document.getElementById('vB_Editor_001_textarea'), container = $.e('div', {innerHTML: ''}); container.querySelector('.text_emo_container_text').appendChild(a); a.style.width = null; t.appendChild(container); emoji.make(container.querySelector('.text_emo_container_emo'), a); return new Extra(); }, initialize: function () { this.quickreply = true; this.buster(); this.store(); this.ext = new Extra(false, true); this.ext.BB.del = this.del; this.ext.BB.save = this.sav; }, processPosts: function () { var i = this.j.length, e, q; if (!this.closed) { window.addEventListener('keydown', helper.toggleImageQuotes, false); window.addEventListener('keypress', helper.toggleImageQuotes, false); update.css('.quickreplyformp div.vBulletin_editor { background: transparent; border: 0; padding: 0 } #quickreplybox { position:fixed; top:0; left:0; width: 100%; background: transparent; text-align: center; } #quickreplybox span { background: #4aa4b7; color: #fff; padding: 3px; border-radius: 3px } #quickreplybox span:hover { background: #47a947; cursor: pointer} .hide { display: none; } .newreplybox { font-family: Arial, Verdana, sans-serif; width: 95%; margin: auto; padding: 9px 8px 6px} .inpost .newreplybox { width: 90% !important; border: 1px solid #ccc} .quickreplyformp textarea {font-size:110%; display:block; margin: auto} .newreplybox .vBulletin_editor { border: 0 none !important; } .newreplybox p { margin: .5em 0 .1em; text-align: center} .quickquotes, .quickquoted { cursor: pointer; background: url(' + this.img.button + ') no-repeat; -moz-background-size: 16px 16px; background-size: 16px 16px; width:16px; height:16px; margin-right:2px; transition-duration: .2s; } .quickquotes:hover{opacity:.8} .quickquotes:active,.quickquoted,.quickquoted:hover{opacity:.5} #quickreplyformpoff { position: fixed; z-index: 1000; top: 28px; left: 150px; } #vB_Editor_001 { border: none; background: transparent; margin: 0; padding: 0 } \n.newreplybox .imagebutton { border: 0 !important; padding: 1px !important; margin: 0 2px;} .resize_merger.imagebutton { background: transparent !important; padding: 0 !important; vertical-align: middle; } .newreplybox .imagebutton:hover img { background-color: #C1D2EE; border-radius: 2px } .newreplybox .controlbar { text-align:center; padding: 0px; margin: 4px auto 2px auto; } .newreplybox .controlbar > div { display:inline-block } .newreplybox .large-button.submit:focus { outline: none;border-radius:3px; background-color:#01518E; border:0; color:#eee;} .newreplybox .large-button.submit:active{ outline: none; border-radius: 3px; background-color:#666; border:0; color:#fff; } \n.post { min-height: 108px } .editarea .newreplybox { width: 650px; margin: 12px 6px } .editarea textarea { width: 99% !important; } .editarea textarea, .biginput { border:1px solid #bbb } #qqre_labelimg2url{display:block;font-size:11px;margin:3px 0;}.newreplybox input[type="radio"],#qqre_img{width:13px;height:13px;padding:0;margin:0 0 0 4px;vertical-align:bottom;position:relative;top:-1px;}.inpost .newreplybox{width: 94%} .qqre_shortcuts {font-weight:bold;cursor:pointer} .qqre_shortcuts:hover {text-decoration:underline} #qqreshortcuts { margin: 5px 0; padding: 0; text-align: center; } #qqreshortcuts li {color: #333; display: inline; padding: 0 3px; } #vB_Editor_001_cmd_wrap0_spoiler { visibility:hidden !important }'); scopeScript(function () { // prevents Chrome from opening the default editor var i, a = document.querySelectorAll('a.post-button'); for (i = 0; i < a.length; i++) { a[i].onclick = null; } }); while (i--) { e = this.j[i]; e.textContent += '+'; e.title = 'Quick Editor++'; e.onclick = null; q = new Editor(e); // console.log(q); } q = null; if (this.form()) { this.initialize(); } this.posts(); } } }; if (!helper.token()) { // console.log('Token unavailable.'); // add messenger to this script window.addEventListener('message', function (event) { if (event.data.type && (event.data.type === 'QQRE_PAGE')) { greaseWindow[event.data.prop] = event.data.val; if (event.data.prop === 'SECURITYTOKEN') { helper.go(); } } }, false); // message from page scope scopeScript(function () { window.postMessage({ type: 'QQRE_PAGE', prop: 'SECURITYTOKEN', val: window.SECURITYTOKEN }, '*'); }); // otherwise . . . window.setTimeout(function () { if (!helper.token()) { helper.token = helper.tokenFromPage; helper.go(); } }, 500); } else { helper.go(); } document.addEventListener("LiveThreadUpdate", function(){helper.posts()}); }());