Small fixes

Utf8 clear supports icon unicode
This commit is contained in:
RainLoop Team 2015-02-25 19:29:34 +04:00
parent e6725198c4
commit 19f089d0bf
15 changed files with 141 additions and 62 deletions

View file

@ -7,7 +7,6 @@
Globals = {},
window = require('window'),
is = require('is'),
_ = require('_'),
$ = require('$'),
ko = require('ko'),
@ -69,14 +68,21 @@
Globals.bUnload = false;
/**
* @type {boolean}
* @type {string}
*/
Globals.bTabletDevice = is.tablet();
Globals.sUserAgent = 'navigator' in window && 'userAgent' in window.navigator &&
window.navigator.userAgent.toLowerCase() || '';
/**
* @type {boolean}
*/
Globals.bMobileDevice = is.mobile() || is.tablet();
Globals.bMobileDevice =
/android/i.test(Globals.sUserAgent) ||
/iphone/i.test(Globals.sUserAgent) ||
/ipod/i.test(Globals.sUserAgent) ||
/ipad/i.test(Globals.sUserAgent) ||
/blackberry/i.test(Globals.sUserAgent)
;
/**
* @type {boolean}

View file

@ -58,7 +58,7 @@
this.selectedItem(null);
}
}
else if (this.bAutoSelect && this.focusedItem())
else if (this.autoSelect() && this.focusedItem())
{
this.selectedItem(this.focusedItem());
}
@ -124,10 +124,10 @@
this.sItemFocusedSelector = sItemFocusedSelector;
this.sLastUid = '';
this.bAutoSelect = true;
this.oCallbacks = {};
this.emptyFunction = function () {};
this.emptyTrueFunction = function () { return true; };
this.focusedItem.subscribe(function (oItem) {
if (oItem)
@ -221,7 +221,7 @@
this.selectedItemUseCallback = true;
if (!bChecked && !bSelected && this.bAutoSelect)
if (!bChecked && !bSelected && this.autoSelect())
{
if (self.focusedItem())
{
@ -392,9 +392,12 @@
}
};
Selector.prototype.autoSelect = function (bValue)
/**
* @returns {boolean}
*/
Selector.prototype.autoSelect = function ()
{
this.bAutoSelect = !!bValue;
return !!(this.oCallbacks['onAutoSelect'] || this.emptyTrueFunction)();
};
/**
@ -540,7 +543,7 @@
}
}
if ((this.bAutoSelect || !!bForceSelect) &&
if ((this.autoSelect() || !!bForceSelect) &&
!this.isListChecked() && Enums.EventKeyCode.Space !== iEventKeyCode)
{
this.selectedItem(oResult);

View file

@ -244,9 +244,7 @@
*/
Utils.encodeHtml = function (sText)
{
return Utils.isNormal(sText) ? sText.toString()
.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;')
.replace(/"/g, '&quot;').replace(/'/g, '&#039;') : '';
return Utils.isNormal(sText) ? _.escape(sText.toString()) : '';
};
/**
@ -512,7 +510,7 @@
/**
* @param {?} oEvent
*/
Utils.killCtrlAandS = function (oEvent)
Utils.kill_CtrlA_CtrlS = function (oEvent)
{
oEvent = oEvent || window.event;
if (oEvent && oEvent.ctrlKey && !oEvent.shiftKey && !oEvent.altKey)
@ -944,7 +942,7 @@
fixAttibuteValue = function () {
return (arguments && 1 < arguments.length) ?
'' + arguments[1] + arguments[2].replace(/</g, '&lt;').replace(/>/g, '&gt;') : '';
'' + arguments[1] + _.escape(arguments[2]) : '';
},
convertLinks = function () {
@ -1550,6 +1548,36 @@
}
};
/**
* @param {string} sStr
* @return {string}
*/
Utils.FullHtmlEncode = function (sStr)
{
var
iIndex = 0,
sChr = '',
iChrCode = 0,
sResult = '';
;
for (iIndex = 0; iIndex < sStr.length; iIndex++)
{
sChr = sStr[iIndex];
if (-1 < Utils.inArray(sChr, ['&', '<', '>', '"', '`', '\'']))
{
sResult += _.escape(sChr);
}
else
{
iChrCode = sChr.charCodeAt(0);
sResult += (iChrCode > 128) ? '&#' + iChrCode + ';' : sChr;
}
}
return sResult;
};
/**
* @param {Object|Array} mObjectOrObjects
*/