Initial commit
This commit is contained in:
commit
65e0da7e11
1397 changed files with 596542 additions and 0 deletions
1
site/OFF_plugins/typography/assets/js/dist/copyfix.min.js
vendored
Normal file
1
site/OFF_plugins/typography/assets/js/dist/copyfix.min.js
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
!function(e,a,t){function n(e){var a,t,o,i=0;switch(d){case"|":a="\\|";break;case"+":a="\\+";break;case"*":a="\\*";break;default:a=d}switch(r){case"|":t="\\|";break;case"+":t="\\+";break;case"*":t="\\*";break;default:t=r}for(o=e.childNodes[i];o;)3===o.nodeType?(o.data=o.data.replace(new RegExp(a,"g"),""),o.data=o.data.replace(new RegExp(t,"g"),"")):1===o.nodeType&&n(o),i+=1,o=e.childNodes[i]}function o(t){t.stopPropagation();var o=(a.body,e.getSelection()),d=o.getRangeAt(0),r=a.createElement("div");r.style.cssText="position: absolute;left: -1000px;width: 900px;overflow: hidden;",a.body.appendChild(r),r.appendChild(d.cloneContents()),n(r),o.selectAllChildren(r),e.setTimeout(function(){r.parentNode.removeChild(r),o.removeAllRanges(),o.addRange(d)},0)}var d=String.fromCharCode(173),r=String.fromCharCode(8203);e.getSelection&&a.addEventListener("copy",o)}(window,document);
|
||||
87
site/OFF_plugins/typography/assets/js/src/copyfix.js
Normal file
87
site/OFF_plugins/typography/assets/js/src/copyfix.js
Normal file
|
|
@ -0,0 +1,87 @@
|
|||
(function (window, document, undefined) {
|
||||
|
||||
// Removal function based on Hyphenator 5.2.0(devel)
|
||||
// Copyright (C) 2015 Mathias Nater, Zürich (mathiasnater at gmail dot com)
|
||||
// https://github.com/mnater/Hyphenator
|
||||
// Released under the MIT license
|
||||
// http://mnater.github.io/Hyphenator/LICENSE.txt
|
||||
|
||||
var hyphen = String.fromCharCode(173),
|
||||
urlhyphen = String.fromCharCode(8203);
|
||||
|
||||
function removeHyphenationFromElement(el) {
|
||||
var h, u, i = 0, n;
|
||||
switch (hyphen) {
|
||||
case '|':
|
||||
h = '\\|';
|
||||
break;
|
||||
case '+':
|
||||
h = '\\+';
|
||||
break;
|
||||
case '*':
|
||||
h = '\\*';
|
||||
break;
|
||||
default:
|
||||
h = hyphen;
|
||||
}
|
||||
switch (urlhyphen) {
|
||||
case '|':
|
||||
u = '\\|';
|
||||
break;
|
||||
case '+':
|
||||
u = '\\+';
|
||||
break;
|
||||
case '*':
|
||||
u = '\\*';
|
||||
break;
|
||||
default:
|
||||
u = urlhyphen;
|
||||
}
|
||||
n = el.childNodes[i];
|
||||
while (!!n) {
|
||||
if (n.nodeType === 3) {
|
||||
n.data = n.data.replace(new RegExp(h, 'g'), '');
|
||||
n.data = n.data.replace(new RegExp(u, 'g'), '');
|
||||
} else if (n.nodeType === 1) {
|
||||
removeHyphenationFromElement(n);
|
||||
}
|
||||
i += 1;
|
||||
n = el.childNodes[i];
|
||||
}
|
||||
}
|
||||
|
||||
// Based on: http://bavotasan.com/2010/add-a-copyright-notice-to-copied-text/
|
||||
function fixBeforeCopy(e) {
|
||||
e.stopPropagation();
|
||||
|
||||
var body_element = document.body,
|
||||
selection = window.getSelection(),
|
||||
range = selection.getRangeAt(0),
|
||||
copytext = selection,
|
||||
dummy = document.createElement('div');
|
||||
|
||||
dummy.style.cssText =
|
||||
'position: absolute;' +
|
||||
'left: -1000px;' +
|
||||
'width: 900px;' +
|
||||
'overflow: hidden;';
|
||||
|
||||
document.body.appendChild(dummy);
|
||||
|
||||
dummy.appendChild(range.cloneContents());
|
||||
|
||||
removeHyphenationFromElement(dummy);
|
||||
selection.selectAllChildren(dummy);
|
||||
|
||||
window.setTimeout(function () {
|
||||
dummy.parentNode.removeChild(dummy);
|
||||
selection.removeAllRanges(); //IE9 needs that
|
||||
selection.addRange(range);
|
||||
}, 0);
|
||||
}
|
||||
|
||||
if (!!window.getSelection) {
|
||||
document.addEventListener("copy", fixBeforeCopy);
|
||||
}
|
||||
|
||||
})(window, document);
|
||||
Loading…
Add table
Add a link
Reference in a new issue