mirror of
https://github.com/prometheus/prometheus.git
synced 2024-11-10 07:34:04 -08:00
This commit is contained in:
parent
3369422327
commit
5d707d3aa3
File diff suppressed because one or more lines are too long
163
web/ui/static/vendor/js/jquery.hotkeys.js
vendored
163
web/ui/static/vendor/js/jquery.hotkeys.js
vendored
|
@ -11,90 +11,103 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
(function(jQuery){
|
(function(jQuery){
|
||||||
|
|
||||||
jQuery.hotkeys = {
|
|
||||||
version: "0.8",
|
|
||||||
|
|
||||||
specialKeys: {
|
jQuery.hotkeys = {
|
||||||
8: "backspace", 9: "tab", 13: "return", 16: "shift", 17: "ctrl", 18: "alt", 19: "pause",
|
version: "0.8+",
|
||||||
20: "capslock", 27: "esc", 32: "space", 33: "pageup", 34: "pagedown", 35: "end", 36: "home",
|
|
||||||
37: "left", 38: "up", 39: "right", 40: "down", 45: "insert", 46: "del",
|
|
||||||
96: "0", 97: "1", 98: "2", 99: "3", 100: "4", 101: "5", 102: "6", 103: "7",
|
|
||||||
104: "8", 105: "9", 106: "*", 107: "+", 109: "-", 110: ".", 111 : "/",
|
|
||||||
112: "f1", 113: "f2", 114: "f3", 115: "f4", 116: "f5", 117: "f6", 118: "f7", 119: "f8",
|
|
||||||
120: "f9", 121: "f10", 122: "f11", 123: "f12", 144: "numlock", 145: "scroll", 191: "/", 224: "meta"
|
|
||||||
},
|
|
||||||
|
|
||||||
shiftNums: {
|
|
||||||
"`": "~", "1": "!", "2": "@", "3": "#", "4": "$", "5": "%", "6": "^", "7": "&",
|
|
||||||
"8": "*", "9": "(", "0": ")", "-": "_", "=": "+", ";": ": ", "'": "\"", ",": "<",
|
|
||||||
".": ">", "/": "?", "\\": "|"
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
function keyHandler( handleObj ) {
|
specialKeys: {
|
||||||
// Only care when a possible input has been specified
|
8: "backspace", 9: "tab", 13: "return", 16: "shift", 17: "ctrl", 18: "alt", 19: "pause",
|
||||||
if ( typeof handleObj.data !== "string" ) {
|
20: "capslock", 27: "esc", 32: "space", 33: "pageup", 34: "pagedown", 35: "end", 36: "home",
|
||||||
return;
|
37: "left", 38: "up", 39: "right", 40: "down", 45: "insert", 46: "del",
|
||||||
}
|
96: "0", 97: "1", 98: "2", 99: "3", 100: "4", 101: "5", 102: "6", 103: "7",
|
||||||
|
104: "8", 105: "9", 106: "*", 107: "+", 109: "-", 110: ".", 111 : "/",
|
||||||
var origHandler = handleObj.handler,
|
112: "f1", 113: "f2", 114: "f3", 115: "f4", 116: "f5", 117: "f6", 118: "f7", 119: "f8",
|
||||||
keys = handleObj.data.toLowerCase().split(" "),
|
120: "f9", 121: "f10", 122: "f11", 123: "f12", 144: "numlock", 145: "scroll", 188: ",", 190: ".",
|
||||||
textAcceptingInputTypes = ["text", "password", "number", "email", "url", "range", "date", "month", "week", "time", "datetime", "datetime-local", "search", "color"];
|
191: "/", 224: "meta"
|
||||||
|
},
|
||||||
handleObj.handler = function( event ) {
|
|
||||||
// Don't fire in text-accepting inputs that we didn't directly bind to
|
|
||||||
if ( this !== event.target && (/textarea|select/i.test( event.target.nodeName ) ||
|
|
||||||
jQuery.inArray(event.target.type, textAcceptingInputTypes) > -1 ) ) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Keypress represents characters, not special keys
|
|
||||||
var special = event.type !== "keypress" && jQuery.hotkeys.specialKeys[ event.which ],
|
|
||||||
character = String.fromCharCode( event.which ).toLowerCase(),
|
|
||||||
key, modif = "", possible = {};
|
|
||||||
|
|
||||||
// check combinations (alt|ctrl|shift+anything)
|
shiftNums: {
|
||||||
if ( event.altKey && special !== "alt" ) {
|
"`": "~", "1": "!", "2": "@", "3": "#", "4": "$", "5": "%", "6": "^", "7": "&",
|
||||||
modif += "alt+";
|
"8": "*", "9": "(", "0": ")", "-": "_", "=": "+", ";": ": ", "'": "\"", ",": "<",
|
||||||
}
|
".": ">", "/": "?", "\\": "|"
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
if ( event.ctrlKey && special !== "ctrl" ) {
|
function keyHandler( handleObj ) {
|
||||||
modif += "ctrl+";
|
|
||||||
}
|
|
||||||
|
|
||||||
// TODO: Need to make sure this works consistently across platforms
|
|
||||||
if ( event.metaKey && !event.ctrlKey && special !== "meta" ) {
|
|
||||||
modif += "meta+";
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( event.shiftKey && special !== "shift" ) {
|
var origHandler = handleObj.handler,
|
||||||
modif += "shift+";
|
//use namespace as keys so it works with event delegation as well
|
||||||
}
|
//will also allow removing listeners of a specific key combination
|
||||||
|
//and support data objects
|
||||||
|
keys = (handleObj.namespace || "").toLowerCase().split(" ");
|
||||||
|
keys = jQuery.map(keys, function(key) { return key.split("."); });
|
||||||
|
|
||||||
if ( special ) {
|
//no need to modify handler if no keys specified
|
||||||
possible[ modif + special ] = true;
|
//Added keys[0].substring(0, 12) to work with jQuery ui 1.9.0
|
||||||
|
//Added accordion, tabs and menu, then jquery ui can use keys.
|
||||||
|
|
||||||
} else {
|
if (keys.length === 1 && (keys[0] === "" ||
|
||||||
possible[ modif + character ] = true;
|
keys[0].substring(0, 12) === "autocomplete" ||
|
||||||
possible[ modif + jQuery.hotkeys.shiftNums[ character ] ] = true;
|
keys[0].substring(0, 9) === "accordion" ||
|
||||||
|
keys[0].substring(0, 4) === "tabs" ||
|
||||||
|
keys[0].substring(0, 4) === "menu")) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// "$" can be triggered as "Shift+4" or "Shift+$" or just "$"
|
handleObj.handler = function( event ) {
|
||||||
if ( modif === "shift+" ) {
|
// Don't fire in text-accepting inputs that we didn't directly bind to
|
||||||
possible[ jQuery.hotkeys.shiftNums[ character ] ] = true;
|
// important to note that $.fn.prop is only available on jquery 1.6+
|
||||||
}
|
if ( this !== event.target && (/textarea|select/i.test( event.target.nodeName ) ||
|
||||||
}
|
event.target.type === "text" || $(event.target).prop('contenteditable') == 'true' )) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
for ( var i = 0, l = keys.length; i < l; i++ ) {
|
// Keypress represents characters, not special keys
|
||||||
if ( possible[ keys[i] ] ) {
|
var special = event.type !== "keypress" && jQuery.hotkeys.specialKeys[ event.which ],
|
||||||
return origHandler.apply( this, arguments );
|
character = String.fromCharCode( event.which ).toLowerCase(),
|
||||||
}
|
key, modif = "", possible = {};
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
jQuery.each([ "keydown", "keyup", "keypress" ], function() {
|
// check combinations (alt|ctrl|shift+anything)
|
||||||
jQuery.event.special[ this ] = { add: keyHandler };
|
if ( event.altKey && special !== "alt" ) {
|
||||||
});
|
modif += "alt_";
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( event.ctrlKey && special !== "ctrl" ) {
|
||||||
|
modif += "ctrl_";
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: Need to make sure this works consistently across platforms
|
||||||
|
if ( event.metaKey && !event.ctrlKey && special !== "meta" ) {
|
||||||
|
modif += "meta_";
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( event.shiftKey && special !== "shift" ) {
|
||||||
|
modif += "shift_";
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( special ) {
|
||||||
|
possible[ modif + special ] = true;
|
||||||
|
|
||||||
|
} else {
|
||||||
|
possible[ modif + character ] = true;
|
||||||
|
possible[ modif + jQuery.hotkeys.shiftNums[ character ] ] = true;
|
||||||
|
|
||||||
|
// "$" can be triggered as "Shift+4" or "Shift+$" or just "$"
|
||||||
|
if ( modif === "shift_" ) {
|
||||||
|
possible[ jQuery.hotkeys.shiftNums[ character ] ] = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for ( var i = 0, l = keys.length; i < l; i++ ) {
|
||||||
|
if ( possible[ keys[i] ] ) {
|
||||||
|
return origHandler.apply( this, arguments );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
jQuery.each([ "keydown", "keyup", "keypress" ], function() {
|
||||||
|
jQuery.event.special[ this ] = { add: keyHandler };
|
||||||
|
});
|
||||||
|
|
||||||
})( jQuery );
|
})( jQuery );
|
8
web/ui/static/vendor/js/jquery.min.js
vendored
8
web/ui/static/vendor/js/jquery.min.js
vendored
File diff suppressed because one or more lines are too long
136
web/ui/static/vendor/js/jquery.selection.js
vendored
136
web/ui/static/vendor/js/jquery.selection.js
vendored
|
@ -1,7 +1,7 @@
|
||||||
/*!
|
/*!
|
||||||
* jQuery.selection - jQuery Plugin
|
* jQuery.selection - jQuery Plugin
|
||||||
*
|
*
|
||||||
* Copyright (c) 2010-2012 IWASAKI Koji (@madapaja).
|
* Copyright (c) 2010-2014 IWASAKI Koji (@madapaja).
|
||||||
* http://blog.madapaja.net/
|
* http://blog.madapaja.net/
|
||||||
* Under The MIT License
|
* Under The MIT License
|
||||||
*
|
*
|
||||||
|
@ -26,13 +26,13 @@
|
||||||
*/
|
*/
|
||||||
(function($, win, doc) {
|
(function($, win, doc) {
|
||||||
/**
|
/**
|
||||||
* 要素の文字列選択状態を取得します
|
* get caret status of the selection of the element
|
||||||
*
|
*
|
||||||
* @param {Element} element 対象要素
|
* @param {Element} element target DOM element
|
||||||
* @return {Object} return
|
* @return {Object} return
|
||||||
* @return {String} return.text 選択されている文字列
|
* @return {String} return.text selected text
|
||||||
* @return {Integer} return.start 選択開始位置
|
* @return {Number} return.start start position of the selection
|
||||||
* @return {Integer} return.end 選択終了位置
|
* @return {Number} return.end end position of the selection
|
||||||
*/
|
*/
|
||||||
var _getCaretInfo = function(element){
|
var _getCaretInfo = function(element){
|
||||||
var res = {
|
var res = {
|
||||||
|
@ -42,13 +42,13 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
if (!element.value) {
|
if (!element.value) {
|
||||||
/* 値がない、もしくは空文字列 */
|
/* no value or empty string */
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (win.getSelection) {
|
if (win.getSelection) {
|
||||||
/* IE 以外 */
|
/* except IE */
|
||||||
res.start = element.selectionStart;
|
res.start = element.selectionStart;
|
||||||
res.end = element.selectionEnd;
|
res.end = element.selectionEnd;
|
||||||
res.text = element.value.slice(res.start, res.end);
|
res.text = element.value.slice(res.start, res.end);
|
||||||
|
@ -57,8 +57,7 @@
|
||||||
element.focus();
|
element.focus();
|
||||||
|
|
||||||
var range = doc.selection.createRange(),
|
var range = doc.selection.createRange(),
|
||||||
range2 = doc.body.createTextRange(),
|
range2 = doc.body.createTextRange();
|
||||||
tmpLength;
|
|
||||||
|
|
||||||
res.text = range.text;
|
res.text = range.text;
|
||||||
|
|
||||||
|
@ -74,24 +73,24 @@
|
||||||
res.end = res.start + range.text.length;
|
res.end = res.start + range.text.length;
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
/* あきらめる */
|
/* give up */
|
||||||
}
|
}
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 要素に対するキャレット操作
|
* caret operation for the element
|
||||||
* @type {Object}
|
* @type {Object}
|
||||||
*/
|
*/
|
||||||
var _CaretOperation = {
|
var _CaretOperation = {
|
||||||
/**
|
/**
|
||||||
* 要素のキャレット位置を取得します
|
* get caret position
|
||||||
*
|
*
|
||||||
* @param {Element} element 対象要素
|
* @param {Element} element target element
|
||||||
* @return {Object} return
|
* @return {Object} return
|
||||||
* @return {Integer} return.start 選択開始位置
|
* @return {Number} return.start start position for the selection
|
||||||
* @return {Integer} return.end 選択終了位置
|
* @return {Number} return.end end position for the selection
|
||||||
*/
|
*/
|
||||||
getPos: function(element) {
|
getPos: function(element) {
|
||||||
var tmp = _getCaretInfo(element);
|
var tmp = _getCaretInfo(element);
|
||||||
|
@ -99,20 +98,20 @@
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 要素のキャレット位置を設定します
|
* set caret position
|
||||||
*
|
*
|
||||||
* @param {Element} element 対象要素
|
* @param {Element} element target element
|
||||||
* @param {Object} toRange 設定するキャレット位置
|
* @param {Object} toRange caret position
|
||||||
* @param {Integer} toRange.start 選択開始位置
|
* @param {Number} toRange.start start position for the selection
|
||||||
* @param {Integer} toRange.end 選択終了位置
|
* @param {Number} toRange.end end position for the selection
|
||||||
* @param {String} caret キャレットモード "keep" | "start" | "end" のいずれか
|
* @param {String} caret caret mode: any of the following: "keep" | "start" | "end"
|
||||||
*/
|
*/
|
||||||
setPos: function(element, toRange, caret) {
|
setPos: function(element, toRange, caret) {
|
||||||
caret = this._caretMode(caret);
|
caret = this._caretMode(caret);
|
||||||
|
|
||||||
if (caret == 'start') {
|
if (caret === 'start') {
|
||||||
toRange.end = toRange.start;
|
toRange.end = toRange.start;
|
||||||
} else if (caret == 'end') {
|
} else if (caret === 'end') {
|
||||||
toRange.start = toRange.end;
|
toRange.start = toRange.end;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -135,29 +134,29 @@
|
||||||
element.setSelectionRange(toRange.start, toRange.end);
|
element.setSelectionRange(toRange.start, toRange.end);
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
/* あきらめる */
|
/* give up */
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 要素内の選択文字列を取得します
|
* get selected text
|
||||||
*
|
*
|
||||||
* @param {Element} element 対象要素
|
* @param {Element} element target element
|
||||||
* @return {String} return 選択文字列
|
* @return {String} return selected text
|
||||||
*/
|
*/
|
||||||
getText: function(element) {
|
getText: function(element) {
|
||||||
return _getCaretInfo(element).text;
|
return _getCaretInfo(element).text;
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* キャレットモードを選択します
|
* get caret mode
|
||||||
*
|
*
|
||||||
* @param {String} caret キャレットモード
|
* @param {String} caret caret mode
|
||||||
* @return {String} return "keep" | "start" | "end" のいずれか
|
* @return {String} return any of the following: "keep" | "start" | "end"
|
||||||
*/
|
*/
|
||||||
_caretMode: function(caret) {
|
_caretMode: function(caret) {
|
||||||
caret = caret || "keep";
|
caret = caret || "keep";
|
||||||
if (caret == false) {
|
if (caret === false) {
|
||||||
caret = 'end';
|
caret = 'end';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -175,11 +174,11 @@
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 選択文字列を置き換えます
|
* replace selected text
|
||||||
*
|
*
|
||||||
* @param {Element} element 対象要素
|
* @param {Element} element target element
|
||||||
* @param {String} text 置き換える文字列
|
* @param {String} text replacement text
|
||||||
* @param {String} caret キャレットモード "keep" | "start" | "end" のいずれか
|
* @param {String} caret caret mode: any of the following: "keep" | "start" | "end"
|
||||||
*/
|
*/
|
||||||
replace: function(element, text, caret) {
|
replace: function(element, text, caret) {
|
||||||
var tmp = _getCaretInfo(element),
|
var tmp = _getCaretInfo(element),
|
||||||
|
@ -194,11 +193,11 @@
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 文字列を選択文字列の前に挿入します
|
* insert before the selected text
|
||||||
*
|
*
|
||||||
* @param {Element} element 対象要素
|
* @param {Element} element target element
|
||||||
* @param {String} text 挿入文字列
|
* @param {String} text insertion text
|
||||||
* @param {String} caret キャレットモード "keep" | "start" | "end" のいずれか
|
* @param {String} caret caret mode: any of the following: "keep" | "start" | "end"
|
||||||
*/
|
*/
|
||||||
insertBefore: function(element, text, caret) {
|
insertBefore: function(element, text, caret) {
|
||||||
var tmp = _getCaretInfo(element),
|
var tmp = _getCaretInfo(element),
|
||||||
|
@ -213,11 +212,11 @@
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 文字列を選択文字列の後に挿入します
|
* insert after the selected text
|
||||||
*
|
*
|
||||||
* @param {Element} element 対象要素
|
* @param {Element} element target element
|
||||||
* @param {String} text 挿入文字列
|
* @param {String} text insertion text
|
||||||
* @param {String} caret キャレットモード "keep" | "start" | "end" のいずれか
|
* @param {String} caret caret mode: any of the following: "keep" | "start" | "end"
|
||||||
*/
|
*/
|
||||||
insertAfter: function(element, text, caret) {
|
insertAfter: function(element, text, caret) {
|
||||||
var tmp = _getCaretInfo(element),
|
var tmp = _getCaretInfo(element),
|
||||||
|
@ -232,16 +231,16 @@
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/* jQuery.selection を追加 */
|
/* add jQuery.selection */
|
||||||
$.extend({
|
$.extend({
|
||||||
/**
|
/**
|
||||||
* ウィンドウの選択されている文字列を取得
|
* get selected text on the window
|
||||||
*
|
*
|
||||||
* @param {String} mode 選択モード "text" | "html" のいずれか
|
* @param {String} mode selection mode: any of the following: "text" | "html"
|
||||||
* @return {String} return
|
* @return {String} return
|
||||||
*/
|
*/
|
||||||
selection: function(mode) {
|
selection: function(mode) {
|
||||||
var getText = ((mode || 'text').toLowerCase() == 'text');
|
var getText = ((mode || 'text').toLowerCase() === 'text');
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (win.getSelection) {
|
if (win.getSelection) {
|
||||||
|
@ -272,14 +271,14 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
/* あきらめる */
|
/* give up */
|
||||||
}
|
}
|
||||||
|
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
/* selection を追加 */
|
/* add selection */
|
||||||
$.fn.extend({
|
$.fn.extend({
|
||||||
selection: function(mode, opts) {
|
selection: function(mode, opts) {
|
||||||
opts = opts || {};
|
opts = opts || {};
|
||||||
|
@ -287,71 +286,66 @@
|
||||||
switch (mode) {
|
switch (mode) {
|
||||||
/**
|
/**
|
||||||
* selection('getPos')
|
* selection('getPos')
|
||||||
* キャレット位置を取得します
|
* get caret position
|
||||||
*
|
*
|
||||||
* @return {Object} return
|
* @return {Object} return
|
||||||
* @return {Integer} return.start 選択開始位置
|
* @return {Number} return.start start position for the selection
|
||||||
* @return {Integer} return.end 選択終了位置
|
* @return {Number} return.end end position for the selection
|
||||||
*/
|
*/
|
||||||
case 'getPos':
|
case 'getPos':
|
||||||
return _CaretOperation.getPos(this[0]);
|
return _CaretOperation.getPos(this[0]);
|
||||||
break;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* selection('setPos', opts)
|
* selection('setPos', opts)
|
||||||
* キャレット位置を設定します
|
* set caret position
|
||||||
*
|
*
|
||||||
* @param {Integer} opts.start 選択開始位置
|
* @param {Number} opts.start start position for the selection
|
||||||
* @param {Integer} opts.end 選択終了位置
|
* @param {Number} opts.end end position for the selection
|
||||||
*/
|
*/
|
||||||
case 'setPos':
|
case 'setPos':
|
||||||
return this.each(function() {
|
return this.each(function() {
|
||||||
_CaretOperation.setPos(this, opts);
|
_CaretOperation.setPos(this, opts);
|
||||||
});
|
});
|
||||||
break;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* selection('replace', opts)
|
* selection('replace', opts)
|
||||||
* 選択文字列を置き換えます
|
* replace the selected text
|
||||||
*
|
*
|
||||||
* @param {String} opts.text 置き換える文字列
|
* @param {String} opts.text replacement text
|
||||||
* @param {String} opts.caret キャレットモード "keep" | "start" | "end" のいずれか
|
* @param {String} opts.caret caret mode: any of the following: "keep" | "start" | "end"
|
||||||
*/
|
*/
|
||||||
case 'replace':
|
case 'replace':
|
||||||
return this.each(function() {
|
return this.each(function() {
|
||||||
_CaretOperation.replace(this, opts.text, opts.caret);
|
_CaretOperation.replace(this, opts.text, opts.caret);
|
||||||
});
|
});
|
||||||
break;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* selection('insert', opts)
|
* selection('insert', opts)
|
||||||
* 選択文字列の前、もしくは後に文字列を挿入えます
|
* insert before/after the selected text
|
||||||
*
|
*
|
||||||
* @param {String} opts.text 挿入文字列
|
* @param {String} opts.text insertion text
|
||||||
* @param {String} opts.caret キャレットモード "keep" | "start" | "end" のいずれか
|
* @param {String} opts.caret caret mode: any of the following: "keep" | "start" | "end"
|
||||||
* @param {String} opts.mode 挿入モード "before" | "after" のいずれか
|
* @param {String} opts.mode insertion mode: any of the following: "before" | "after"
|
||||||
*/
|
*/
|
||||||
case 'insert':
|
case 'insert':
|
||||||
return this.each(function() {
|
return this.each(function() {
|
||||||
if (opts.mode == 'before') {
|
if (opts.mode === 'before') {
|
||||||
_CaretOperation.insertBefore(this, opts.text, opts.caret);
|
_CaretOperation.insertBefore(this, opts.text, opts.caret);
|
||||||
} else {
|
} else {
|
||||||
_CaretOperation.insertAfter(this, opts.text, opts.caret);
|
_CaretOperation.insertAfter(this, opts.text, opts.caret);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
break;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* selection('get')
|
* selection('get')
|
||||||
* 選択されている文字列を取得
|
* get selected text
|
||||||
*
|
*
|
||||||
* @return {String} return
|
* @return {String} return
|
||||||
*/
|
*/
|
||||||
case 'get':
|
case 'get':
|
||||||
|
/* falls through */
|
||||||
default:
|
default:
|
||||||
return _CaretOperation.getText(this[0]);
|
return _CaretOperation.getText(this[0]);
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
|
|
Loading…
Reference in a new issue