User:Kate Aces/Copypastemporium

Category:Policies and guidelines

{|class="ace-table ace-table-center ace-table-shaded" style="width:69%;" !colspan="3"| Icons !style="width:33.33%;"| !style="width:33.33%;"| !style="width:33.33%;"|

{|class="ace-table ace-table-center ace-table-shaded mw-collapsible mw-collapsed" style="width:33.33%; margin:auto;" !colspan="3"| Icons

<!--/* ############################################################################# */ /* ### CLIPBOARD                                                            ### */ /* ###  ### */ /* ### Credit:      JoJo\'s Bizarre Encyclopedia (https://jojowiki.com)      ### */ /* ###             User:Eckserah                                            ### */ /* ############################################################################# */

(function($, document) {   var _notice = '\nThis content comes from the Independent Fallout Wiki (https://fallout.wiki/), and must be attributed to its authors if you are using it on another wiki or web page. Do not copy paste this into your site without giving credit, as specified in the license.'     , _init = function {        if (mw.config.get('wgUserGroups', []).length < 2) {            $('#mw-content-text').on('cut copy', _copyevent);            $(document.body).on('paste', '[contenteditable],input,textarea', _pasteevent);        }    }      , _copyevent = function(e) {        var text, $target;        $target = $(e.target);        if ($target.closest('.ace_editor').length > 0) {            return;        } else if ($target.is('input,textarea')) {            if (e.type == 'cut') {                return;            }            text = $target.val.substring(e.target.selectionStart, e.target.selectionEnd); } else { text = document.getSelection.toString; }       if (text.length < 40) { return; }       text = text + _notice; (e.originalEvent.clipboardData || window.clipboardData).setData('text/plain', text); e.preventDefault; console.log('Content to be copied modified. Report any problems to Vish.'); }    , _pasteevent = function(e) { var paste, selection, input, startPos, endPos, text; paste = (e.originalEvent.clipboardData || window.clipboardData).getData('text/plain'); if (paste.indexOf(_notice) == -1) { return; }       paste = paste.replace(_notice, ''); if ($(event.target).is('[contenteditable]')) { selection = window.getSelection; if (!selection.rangeCount) { return false; }           selection.deleteFromDocument; selection.getRangeAt(0).insertNode(document.createTextNode(paste)); } else { input = event.target; if (input.selectionStart !== undefined) { startPos = input.selectionStart; endPos = input.selectionEnd; text = $(input).val; text = text.substring(0, startPos) + paste + text.substring(endPos); $(input).val(text); endPos = startPos + paste.length; input.setSelectionRange(endPos, endPos); }       }        console.log('Content to paste modified.'); e.preventDefault; };   $(_init); } )(jQuery, document); -->