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
// getFunctionName.js | |
function getFunctionName (func) { | |
var functionBody; | |
functionBody = /^function\s+([^\s(]*)(?=\()/.exec(func.toString()); | |
return functionBody ? functionBody[1] : null; // Function#name || null | |
} |
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
/** | |
* natsort.js | |
* Sort an array using a "natural order" algorithm. | |
* | |
* @version 1.2.4 | |
* @author think49 | |
* @license http://www.opensource.org/licenses/mit-license.php (The MIT License) | |
* @url https://gist.github.com/660141 | |
* @see <a href="http://sourcefrog.net/projects/natsort/">Natural Order String Comparison</a> | |
*/ |
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
/** | |
* getTextNodeList.js | |
* | |
* @version 1.1.7 | |
* @author think49 | |
* @url https://gist.github.com/658424 | |
*/ | |
var getTextNodeList = (function () { |
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
// ExtXPathEvaluator.js | |
function ExtXPathEvaluator () { | |
if (!(this instanceof ExtXPathEvaluator)) { | |
throw new Error(this + ' is not a object created by constructor'); | |
} | |
return this; | |
} |
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
<!DOCTYPE html> | |
<html lang="ja"> | |
<head> | |
<meta charset="UTF-8" /> | |
<title>はじめての Google AJAX Language API</title> | |
<script src="http://www.google.com/jsapi"></script> | |
<script src="./javascript-xpath-latest-cmp.js"></script> | |
<script src="./ExtXPathEvaluator.js"></script> | |
<script> | |
google.load('language', '1'); |
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
// ExtXPathEvaluator.js | |
function ExtXPathEvaluator () { | |
if (!(this instanceof ExtXPathEvaluator)) { | |
throw new Error(this + ' is not a object created by constructor'); | |
} | |
return this; | |
} |
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
// rollover.js | |
(function () { | |
function rolloverListener (event) { | |
var target, relatedTarget, reg, src; | |
target = event.target || event.toElement; | |
relatedTarget = event.relatedTarget || event.fromElement; | |
if (target.tagName === 'IMG') { |
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
// jp-domain.js | |
function JPDomain () { | |
var half_string, hyphen, mark, hiragana, katakana, kanji, TLD, SLD, domain_lastString, alphanum_domain, first_char, middle_char, end_char, japanese_domain; | |
if (!(this instanceof JPDomain)) { | |
throw new Error(this + ' is not a object created by constructor'); | |
} | |
// Base Strings |
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
// expandURI.js | |
if (!Array.indexOf) { | |
Array.indexOf = (function (indexOf) { | |
return function (contextObject, elt /*, from*/) { | |
if (arguments.length < 3) { | |
indexOf.call(contextObject, elt); | |
} else { | |
indexOf.call(contextObject, elt, arguments[2]); | |
} |
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
function getStringByte (str) { | |
return encodeURIComponent(str).replace(/%[\da-zA-Z]+/g, '.').length; | |
} | |
alert(getStringByte('テスト')); // 9 | |
alert(getStringByte('test')); // 4 |