fixing tab in chat
This commit is contained in:
141
jquery/common.js
vendored
141
jquery/common.js
vendored
@@ -1,23 +1,40 @@
|
||||
/* jQuery functions */
|
||||
|
||||
(function($) {
|
||||
$.fn.getCursorPosition = function() {
|
||||
var input = this.get(0);
|
||||
if (!input) return; // No (input) element found
|
||||
if ('selectionStart' in input) {
|
||||
// Standard-compliant browsers
|
||||
return input.selectionStart;
|
||||
} else if (document.selection) {
|
||||
// IE
|
||||
input.focus();
|
||||
var sel = document.selection.createRange();
|
||||
var selLen = document.selection.createRange().text.length;
|
||||
sel.moveStart('character', -input.value.length);
|
||||
return sel.text.length - selLen;
|
||||
}
|
||||
};
|
||||
$.fn.getCursorPosition = function() {
|
||||
var input = this.get(0);
|
||||
if (!input) return; // No (input) element found
|
||||
if ('selectionStart' in input) {
|
||||
// Standard-compliant browsers
|
||||
return input.selectionStart;
|
||||
} else if (document.selection) {
|
||||
// IE
|
||||
input.focus();
|
||||
var sel = document.selection.createRange();
|
||||
var selLen = document.selection.createRange().text.length;
|
||||
sel.moveStart('character', -input.value.length);
|
||||
return sel.text.length - selLen;
|
||||
}
|
||||
};
|
||||
})(jQuery);
|
||||
|
||||
$.fn.setCursorPosition = function(pos)
|
||||
{
|
||||
this.each(function(index, elem)
|
||||
{
|
||||
if(elem.setSelectionRange) elem.setSelectionRange(pos, pos);
|
||||
else if(elem.createTextRange)
|
||||
{
|
||||
var range = elem.createTextRange();
|
||||
range.collapse(true);
|
||||
range.moveEnd('character', pos);
|
||||
range.moveStart('character', pos);
|
||||
range.select();
|
||||
}
|
||||
});
|
||||
return this;
|
||||
};
|
||||
|
||||
$.prototype.addButton = function(sType, sTitle, oClickLink, sId, sButtonClass, sTmpVar)
|
||||
{
|
||||
$This = $(this);
|
||||
@@ -120,29 +137,48 @@ $.prototype.checkForm = function(sSelector)
|
||||
/* Common functions */
|
||||
|
||||
String.prototype.stripVowelAccent = function()
|
||||
{
|
||||
var sText = this;
|
||||
var rExps=
|
||||
[
|
||||
{re:/[\xC0-\xC6]/g, ch:'A'},
|
||||
{re:/[\xE0-\xE6]/g, ch:'a'},
|
||||
{re:/[\xC8-\xCB]/g, ch:'E'},
|
||||
{re:/[\xE8-\xEB]/g, ch:'e'},
|
||||
{re:/[\xCC-\xCF]/g, ch:'I'},
|
||||
{re:/[\xEC-\xEF]/g, ch:'i'},
|
||||
{re:/[\xD2-\xD6]/g, ch:'O'},
|
||||
{re:/[\xF2-\xF6]/g, ch:'o'},
|
||||
{re:/[\xD9-\xDC]/g, ch:'U'},
|
||||
{re:/[\xF9-\xFC]/g, ch:'u'},
|
||||
{re:/[\xD1]/g, ch:'N'},
|
||||
{re:/[\xF1]/g, ch:'n'}
|
||||
];
|
||||
for(var i=0, len=rExps.length; i<len; i++)
|
||||
{
|
||||
var sec = ['193','225','192','224','194','226','461','462','258','259','195','227','7842','7843','7840','7841','196','228','197','229','256','257','260','261','7844','7845','7846','7847','7850','7851','7848','7849','7852','7853','7854','7855','7856','7857','7860','7861','7858','7859','7862','7863','506','507','262','263','264','265','268','269','266','267','199','231','270','271','272','273','201','233','200','232','202','234','282','283','276','277','7868','7869','7866','7867','278','279','203','235','274','275','280','281','7870','7871','7872','7873','7876','7877','7874','7875','7864','7865','7878','7879','286','287','284','285','288','289','290','291','292','293','294','295','205','237','204','236','300','301','206','238','463','464','207','239','296','297','302','303','298','299','7880','7881','7882','7883','308','309','310','311','313','314','317','318','315','316','321','322','319','320','323','324','327','328','209','241','325','326','211','243','210','242','334','335','212','244','7888','7889','7890','7891','7894','7895','7892','7893','465','466','214','246','336','337','213','245','216','248','510','511','332','333','7886','7887','416','417','7898','7899','7900','7901','7904','7905','7902','7903','7906','7907','7884','7885','7896','7897','7764','7765','7766','7767','340','341','344','345','342','343','346','347','348','349','352','353','350','351','356','357','354','355','358','359','218','250','217','249','364','365','219','251','467','468','366','367','220','252','471','472','475','476','473','474','469','470','368','369','360','361','370','371','362','363','7910','7911','431','432','7912','7913','7914','7915','7918','7919','7916','7917','7920','7921','7908','7909','7810','7811','7808','7809','372','373','7812','7813','221','253','7922','7923','374','375','376','255','7928','7929','7926','7927','7924','7925','377','378','381','382','379','380','208'];
|
||||
var rep = ['A','a','A','a','A','a','A','a','A','a','A','a','A','a','A','a','A','a','A','a','A','a','A','a','A','a','A','a','A','a','A','a','A','a','A','a','A','a','A','a','A','a','A','a','A','a','C','c','C','c','C','c','C','c','C','c','D','d','D','d','E','e','E','e','E','e','E','e','E','e','E','e','E','e','E','e','E','e','E','e','E','e','E','e','E','e','E','e','E','e','E','e','E','e','G','g','G','g','G','g','G','g','H','h','H','h','I','i','I','i','I','i','I','i','I','i','I','i','I','i','I','i','I','i','I','i','I','i','J','j','K','k','L','l','L','l','L','l','L','l','L','l','N','n','N','n','N','n','N','n','O','o','O','o','O','o','O','o','O','o','O','o','O','o','O','o','O','o','O','o','O','o','O','o','O','o','O','o','O','o','O','o','O','o','O','o','O','o','O','o','O','o','O','o','O','o','O','o','P','p','P','p','R','r','R','r','R','r','S','s','S','s','S','s','S','s','T','t','T','t','T','t','U','u','U','u','U','u','U','u','U','u','U','u','U','u','U','u','U','u','U','u','U','u','U','u','U','u','U','u','U','u','U','u','U','u','U','u','U','u','U','u','U','u','U','u','U','u','W','w','W','w','W','w','W','w','Y','y','Y','y','Y','y','Y','y','Y','y','Y','y','Y','y','Z','z','Z','z','Z','z','D'];
|
||||
|
||||
var seclen = sec.length;
|
||||
var repwith = -1;
|
||||
var text = this;
|
||||
text = text.replace(/\r/g,'').split('\n');
|
||||
var textout = new Array();
|
||||
var linecnt = text.length;
|
||||
var toremout = '';
|
||||
var chcoat = '';
|
||||
for(var x=0;x<linecnt;x++)
|
||||
{
|
||||
sText=sText.replace(rExps[i].re, rExps[i].ch);
|
||||
torem = text[x].split('');
|
||||
toremout = new Array();
|
||||
toremlen = torem.length;
|
||||
for(var y=0;y<toremlen;y++)
|
||||
{
|
||||
chcoat = torem[y].charCodeAt(0);
|
||||
if(chcoat > 124)
|
||||
{
|
||||
for(var z=0;z<seclen;z++)
|
||||
{
|
||||
if(chcoat == sec[z])
|
||||
{
|
||||
repwith = rep[z];
|
||||
z = seclen;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(repwith != -1)
|
||||
{
|
||||
toremout[y] = repwith;
|
||||
repwith = -1;
|
||||
}
|
||||
else toremout[y] = torem[y];
|
||||
}
|
||||
textout[x] = toremout.join('');
|
||||
}
|
||||
return sText;
|
||||
};
|
||||
return textout.join('\n');
|
||||
}
|
||||
|
||||
String.prototype.replaceAll = function(regex, text)
|
||||
{
|
||||
@@ -337,6 +373,39 @@ function setElem(aoAnchor, asPath, oValue)
|
||||
}
|
||||
}
|
||||
|
||||
function array_search(needle, haystack, argStrict)
|
||||
{
|
||||
var strict = !! argStrict,
|
||||
key = '';
|
||||
if(typeof needle === 'object' && needle.exec)
|
||||
{
|
||||
// Duck-type for RegExp
|
||||
if(!strict)
|
||||
{
|
||||
// Let's consider case sensitive searches as strict
|
||||
var flags = 'i' + (needle.global ? 'g' : '') + (needle.multiline ? 'm' : '') + (needle.sticky ? 'y' : '');
|
||||
needle = new RegExp(needle.source, flags);
|
||||
}
|
||||
for(key in haystack)
|
||||
{
|
||||
if(haystack.hasOwnProperty(key))
|
||||
{
|
||||
if(needle.test(haystack[key])) return key;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
for(key in haystack)
|
||||
{
|
||||
if(haystack.hasOwnProperty(key))
|
||||
{
|
||||
if((strict && haystack[key] === needle) || (!strict && haystack[key] == needle)) return key;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
//Queue element
|
||||
(
|
||||
|
||||
Reference in New Issue
Block a user