Skip to content

Instantly share code, notes, and snippets.

@imzhi
Created June 6, 2016 09:15
Show Gist options
  • Select an option

  • Save imzhi/414821db57a6bee85c75ff95aa1237b1 to your computer and use it in GitHub Desktop.

Select an option

Save imzhi/414821db57a6bee85c75ff95aa1237b1 to your computer and use it in GitHub Desktop.
复制替换空格
// ==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