-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
92 additions
and
6 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
var jfogs = require('jfogs'); | ||
|
||
/** | ||
* jfogs 代码混淆 | ||
* | ||
* @param {string} content 文本内容 | ||
* @param {Object} attrs 属性 | ||
* @param {string} attrs.type 参数混淆方式 | ||
* @param {string} attrs.cross 添加混淆属性 | ||
* @param {Object} scope 作用域 | ||
* @param {Function} scope.execImport 导入数据 | ||
*/ | ||
module.exports = function processor(content, attrs, scope) { | ||
if (!content) { | ||
return content; | ||
} | ||
var options = {}; | ||
options.type = scope.execImport(attrs.type); | ||
options.cross = /^(yes|on|true|ok)$/.test(scope.execImport(attrs.cross)); | ||
return jfogs.obfuscate(content, options); | ||
}; |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset="utf-8"> | ||
<title>jfogs</title> | ||
</head> | ||
<body> | ||
<div></div> | ||
</body> | ||
<script> | ||
/*<jdists encoding="jfogs,uglify" cross="true" type="zero">*/ | ||
/** | ||
* 贝赛尔公式,支持多维数组 | ||
* | ||
* @param{Array[Array[number, ...],...]} items 每个参考点 | ||
* @param{number} rate 比率 | ||
* @return{number|Array[number, ...]} 返回 | ||
*/ | ||
function bezier(items, rate) { | ||
if (!items || !items.length) { | ||
return; | ||
} | ||
var first = items[0]; | ||
var second = items[1]; | ||
var level = first instanceof Array ? first.length : 0; // 下标数,0为非数组 | ||
var i; | ||
switch (items.length) { | ||
case 1: | ||
return level ? first.slice() : first; // 数组需要克隆,非数组直接返回 | ||
case 2: | ||
if (level) { // 非数组 | ||
var result = []; | ||
for (i = 0; i < level; i++) { | ||
result[i] = bezier([first[i], second[i]], rate); | ||
} | ||
return result; | ||
} | ||
return first + (second - first) * rate; | ||
default: | ||
var temp = []; | ||
for (i = 1; i < items.length; i++) { | ||
temp.push(bezier([items[i - 1], items[i]], rate)); | ||
} | ||
return bezier(temp, rate); | ||
} | ||
} | ||
console.log(bezier([1, 5], 0.2)); | ||
/*</jdists>*/ | ||
</script> | ||
</html> |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset="utf-8"> | ||
<title>jfogs</title> | ||
</head> | ||
<body> | ||
<div></div> | ||
</body> | ||
<script> | ||
!function(r,n,e,t,a,f){function o(r,n){if(r&&r[i.ؠ̀]){var e,t=r[i.ء́],a=r[i.آ̂],f=t instanceof Array?t[i.ؠ̀]:0;switch(r[i.ؠ̀]){case 1:return f?t[i.أ̃]():t;case 2:if(f){var u=[];for(e=0;f>e;e++)u[e]=o([t[e],a[e]],n);return u}return t+(a-t)*n;default:var c=[];for(e=1;e<r[i.ؠ̀];e++)c[i.ؤ̄](o([r[e-1],r[e]],n));return o(c,n)}}}for(var u=arguments,c=0;c<u.length;c++)u[c]=u[c].replace(/./g,function(r){return{"":0,"":1}[r]}).replace(/.{7}/g,function(r){return String.fromCharCode(parseInt(r,2))});var i={};i.ؠ̀=r,i.ء́=n,i.آ̂=e,i.أ̃=t,i.ؤ̄=a,i.إ̅=f,console[i.إ̅](o([1,5],.2))}("","","","","",""); | ||
</script> | ||
</html> |