Created
June 6, 2016 09:15
-
-
Save imzhi/414821db57a6bee85c75ff95aa1237b1 to your computer and use it in GitHub Desktop.
复制替换空格
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // ==UserScript== | |
| // @name 复制替换空格 | |
| // @namespace http://tampermonkey.net/ | |
| // @version 0.1.0 | |
| // @description Hello World! | |
| // @author Xiaozhi | |
| // @match http://*/* | |
| // @grant none | |
| // @require http://cdn.bootcss.com/jquery/2.2.3/jquery.js | |
| // ==/UserScript== | |
| (function() { | |
| 'use strict'; | |
| setTimeout(function() { | |
| document.getElementById('ueditor_replace').addEventListener('paste', function(event) { | |
| alert(123123); | |
| var clipboardData = event.originalEvent.clipboardData || window.clipboardData; | |
| var text = clipboardData.getData("text"); | |
| console.log(text); | |
| }); | |
| var line_pat = /.+\n?/mg; | |
| var line = ''; | |
| var new_content = ''; | |
| while (line = line_pat.exec(content)) { | |
| new_content += line[0].replace(/^ +/, function(match) { | |
| return Array(match.length + 1).join('.'); | |
| }); | |
| } | |
| }, 5000); | |
| })(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment