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
/** | |
* Load a JavaScript file from the server, then execute it. | |
* | |
* Code comes from `https://github.com/ded/script.js` | |
* If your want more features, please follow the original | |
* | |
* @usage: | |
* loadScript('http://example.com/test.js', function() { | |
* console.log('Loaded') | |
* }); |
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
/** | |
* Force modify a URL to HTTPS if your website is under HTTPS | |
* | |
* @example resolveHttps('http://example.com') | |
* If you are under a HTTPS website, it'll return `https://example.com`, | |
* Else it'll return `http://example.com` | |
* | |
* @param {string} url | |
* @return {string} | |
*/ |
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
/** | |
* Convert flat data to tree format | |
* | |
* @see http://blog.csdn.net/chelen_jak/article/details/21290769 | |
* | |
* @param {array} a json数据 | |
* @param {String} idStr id的字符串 | |
* @param {String} pidStr 父id的字符串 | |
* @param {String} childrenStr children的字符串 | |
* @return {array} 数组 |
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
div { | |
overflow : hidden; | |
text-overflow: ellipsis; | |
display: -webkit-box; | |
-webkit-line-clamp: 2; /* should be the line count limited */ | |
-webkit-box-orient: vertical; | |
} |
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
/** | |
* Get parameter from URL query(search) string | |
* | |
* Example: | |
* ``` | |
* var id = getQueryString('id') | |
* ``` | |
* | |
* @param {string} name | |
* @returns {string} |
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
/** | |
* Get browser infomation for MixPamel (node) | |
* | |
* Usage: | |
* var detectBrowser = require('./mixPanelDetectBrowser.js') | |
* mixpanel.track('some events', Object.assign({}, detectBrowser(theUserAgentYouGet), { | |
* // your properties | |
* })); | |
* | |
* @param userAgent |
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
<!DOCTYPE html> | |
<html xmlns="http://www.w3.org/1999/xhtml"> | |
<head> | |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> | |
<title></title> | |
</head> | |
<body> | |
<div> | |
<audio controls autoplay></audio> | |
<input onclick="startRecording()" type="button" value="录音" /> |
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
/** | |
* contenteditable 支持, 代码来自 http://stackoverflow.com/questions/23047093/contenteditable-in-angular-js | |
* 对于添加了 contenteditable 属性的元素, 可以直接用 `ng-model` 双向绑定 | |
*/ | |
app.directive('contenteditable', function() { | |
return { | |
restrict: 'A', // only activate on element attribute | |
require: '?ngModel', // get a hold of NgModelController | |
link: function(scope, element, attrs, ngModel) { | |
if(!ngModel) return; // do nothing if no ng-model |
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
function getQueryString (name) { | |
var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i"); | |
var r = window.location.search.substr(1).match(reg); | |
if (r != null) return unescape(r[2]); return null; | |
} |
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
Show hidden characters
{ | |
"presets": [ | |
"react", | |
"es2015" | |
], | |
"plugins": [ | |
"transform-class-properties" | |
] | |
} |
NewerOlder