Skip to content

Commit

Permalink
Recompiled JS and CSS
Browse files Browse the repository at this point in the history
  • Loading branch information
vitmalina committed Jan 4, 2016
1 parent 963bdb9 commit b883689
Show file tree
Hide file tree
Showing 4 changed files with 125 additions and 168 deletions.
96 changes: 38 additions & 58 deletions dist/w2ui-fields.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,39 +28,6 @@ var w2obj = w2obj || {}; // expose object to be able to overwrite default functi
* - add w2utils.lang wrap for all captions in all buttons.
* - $().w2date(), $().w2dateTime()
*
* == 1.5 changes
* - date has problems in FF new Date('yyyy-mm-dd') breaks
* - bug: w2utils.formatDate('2011-31-01', 'yyyy-dd-mm'); - wrong foratter
* - format date and time is buggy
* - added decimalSymbol
* - renamed size() -> formatSize()
* - added cssPrefix()
* - added w2utils.settings.weekStarts
* - onComplete should pass widget as context (this)
* - hidden and disabled in menus
* - added menu.item.tooltip for overlay menus
* - added w2tag options.id, options.left, options.top
* - added w2tag options.position = top|bottom|left|right - default is right
* - added $().w2color(color, callBack)
* - added custom colors
* - added w2menu.options.type = radio|check
* - added w2menu items.hotkey
* - added options.contextMenu, options.pageX, options.pageY (or options.originalEvent) for w2overlay()
* - added options.noTip for w2overlay()
* - added options.overlayStyle for w2overlay()
* - added options.selectable
* - Refactored w2tag
* - added options.style for w2tag
* - added options.hideOnKeyPress for w2tag
* - added options.hideOnBlur for w2tag
* - events 'eventName:after' syntax
* - deprecated onComplete, introduced event.done(func) - can have multiple handlers
* - added getCursorPosition, setCursorPosition
* - w2tag hideOnClick - hides on document click
* - add isDateTime()
* - data_format -> dateFormat, time_format -> timeFormat
* - implemented w2utils.formatters (used in grid)
*
************************************************/

var w2utils = (function ($) {
Expand All @@ -69,8 +36,8 @@ var w2utils = (function ($) {
version : '1.5.x',
settings : {
"locale" : "en-us",
"dateFormat" : "m/d/yyyy",
"timeFormat" : "hh:mi pm",
"dateFormat" : "m/d/yyyy",
"timeFormat" : "hh:mi pm",
"currencyPrefix" : "$",
"currencySuffix" : "",
"currencyPrecision" : 2,
Expand Down Expand Up @@ -187,12 +154,12 @@ var w2utils = (function ($) {

if (typeof val.getUTCFullYear === 'function') { // date object
year = val.getUTCFullYear();
month = val.getUTCMonth();
month = val.getUTCMonth() + 1;
day = val.getUTCDate();
} else if (parseInt(val) == val && parseInt(val) > 0) {
val = new Date(val);
val = new Date(parseInt(val));
year = val.getUTCFullYear();
month = val.getUTCMonth();
month = val.getUTCMonth() + 1;
day = val.getUTCDate();
} else {
val = String(val);
Expand Down Expand Up @@ -228,10 +195,10 @@ var w2utils = (function ($) {
if (!isInt(year)) return false;
if (!isInt(month)) return false;
if (!isInt(day)) return false;
year = +year;
year = +year;
month = +month;
day = +day;
dt = new Date(year, month - 1, day);
day = +day;
dt = new Date(year, month - 1, day);
// do checks
if (month == null) return false;
if (String(dt) == 'Invalid Date') return false;
Expand Down Expand Up @@ -277,12 +244,13 @@ var w2utils = (function ($) {
}

function isDateTime (val, format, retDate) {
if (format == null) format = w2utils.settings.dateFormat + '|' + w2utils.settings.timeFormat;
var formats = format.split('|');
if (typeof val.getUTCFullYear === 'function') { // date object
if (retDate !== true) return true;
return val;
} else if (parseInt(val) == val && parseInt(val) > 0) {
val = new Date(val);
val = new Date(parseInt(val));
if (retDate !== true) return true;
return val;
} else {
Expand All @@ -305,10 +273,16 @@ var w2utils = (function ($) {
}
}

function age (dateStr) {
if (dateStr === '' || dateStr == null || (typeof dateStr == 'object' && !dateStr.getMonth)) return '';
var d1 = new Date(dateStr);
if (w2utils.isInt(dateStr)) d1 = new Date(Number(dateStr)); // for unix timestamps
function age(dateStr) {
var dt1;
if (dateStr === '' || dateStr == null) return '';
if (typeof dateStr.getUTCFullYear === 'function') { // date object
dt1 = dateStr;
} else if (parseInt(dateStr) == dateStr && parseInt(dateStr) > 0) {
d1 = new Date(parseInt(dateStr));
} else {
d1 = new Date(dateStr);
}
if (String(d1) == 'Invalid Date') return '';

var d2 = new Date();
Expand Down Expand Up @@ -393,9 +367,9 @@ var w2utils = (function ($) {
if (!w2utils.isFloat(sizeStr) || sizeStr === '') return '';
sizeStr = parseFloat(sizeStr);
if (sizeStr === 0) return 0;
var sizes = ['Bt', 'KB', 'MB', 'GB', 'TB'];
var sizes = ['Bt', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB'];
var i = parseInt( Math.floor( Math.log(sizeStr) / Math.log(1024) ) );
return (Math.floor(sizeStr / Math.pow(1024, i) * 10) / 10).toFixed(i === 0 ? 0 : 1) + ' ' + sizes[i];
return (Math.floor(sizeStr / Math.pow(1024, i) * 10) / 10).toFixed(i === 0 ? 0 : 1) + ' ' + (sizes[i] || '??');
}

function formatNumber (val, fraction, useGrouping) {
Expand Down Expand Up @@ -1046,7 +1020,7 @@ var w2utils = (function ($) {
return;
}

div_old.parentNode.style.cssText += 'perspective: 700; overflow: hidden;';
div_old.parentNode.style.cssText += 'perspective: 900px; overflow: hidden;';
div_old.style.cssText += '; position: absolute; z-index: 1019; backface-visibility: hidden';
div_new.style.cssText += '; position: absolute; z-index: 1020; backface-visibility: hidden';

Expand Down Expand Up @@ -1415,7 +1389,7 @@ var w2utils = (function ($) {
var doc = input.ownerDocument || input.document;
var win = doc.defaultView || doc.parentWindow;
var sel;
if (input.tagName == 'INPUT' && input.selectionStart) {
if (input.tagName && input.tagName.toUpperCase() == 'INPUT' && input.selectionStart) {
// standards browser
caretOffset = input.selectionStart;
} else {
Expand Down Expand Up @@ -1519,23 +1493,23 @@ w2utils.formatters = {
},

'date': function (value, params) {
if (params == null || params == '') params = w2utils.settings.dateFormat;
if (params == '') params = w2utils.settings.dateFormat;
if (value == null || value == 0) return '';
var dt = w2utils.isDateTime(value, params, true);
if (dt == '') dt = w2utils.isDate(value, params, true);
return '<span title="'+ dt +'">' + w2utils.formatDate(dt, params) + '</span>';
},

'datetime': function (value, params) {
if (params == null || params == '') params = w2utils.settings.dateFormat + '|' + w2utils.settings.timeFormat;
if (params == '') params = w2utils.settings.dateFormat + '|' + w2utils.settings.timeFormat;
if (value == null || value == 0) return '';
var dt = w2utils.isDateTime(value, params, true);
if (dt == '') dt = w2utils.isDate(value, params, true);
return '<span title="'+ dt +'">' + w2utils.formatDateTime(dt, params) + '</span>';
},

'time': function (value, params) {
if (params == null || params == '') params = w2utils.settings.timeFormat;
if (params == '') params = w2utils.settings.timeFormat;
if (params == 'h12') params = 'hh:mi pm';
if (params == 'h24') params = 'h24:mi';
if (value == null || value == 0) return '';
Expand All @@ -1545,15 +1519,15 @@ w2utils.formatters = {
},

'timestamp': function (value, params) {
if (params == null || params == '') params = w2utils.settings.dateFormat + '|' + w2utils.settings.timeFormat;
if (params == '') params = w2utils.settings.dateFormat + '|' + w2utils.settings.timeFormat;
if (value == null || value == 0) return '';
var dt = w2utils.isDateTime(value, params, true);
if (dt == '') dt = w2utils.isDate(value, params, true);
return dt.toString ? dt.toString() : '';
},

'gmt': function (value, params) {
if (params == null || params == '') params = w2utils.settings.dateFormat + '|' + w2utils.settings.timeFormat;
if (params == '') params = w2utils.settings.dateFormat + '|' + w2utils.settings.timeFormat;
if (value == null || value == 0) return '';
var dt = w2utils.isDateTime(value, params, true);
if (dt == '') dt = w2utils.isDate(value, params, true);
Expand All @@ -1562,9 +1536,14 @@ w2utils.formatters = {

'age': function (value, params) {
if (value == null || value == 0) return '';
var dt = w2utils.isDateTime(value, params, true);
if (dt == '') dt = w2utils.isDate(value, params, true);
return '<span title="'+ dt +'">' + w2utils.age(value) + ((' ' + params) || '') + '</span>';
var dt = w2utils.isDateTime(value, null, true);
if (dt == '') dt = w2utils.isDate(value, null, true);
return '<span title="'+ dt +'">' + w2utils.age(value) + (params ? (' ' + params) : '') + '</span>';
},

'interval': function (value, params) {
if (value == null || value == 0) return '';
return w2utils.interval(value) + (params ? (' ' + params) : '');
},

'toggle': function (value, params) {
Expand Down Expand Up @@ -2225,6 +2204,7 @@ w2utils.event = {
img : '',
icon : '',
count : '',
tooltip : '',
hidden : false,
checked : null,
disabled : false
Expand Down
4 changes: 2 additions & 2 deletions dist/w2ui-fields.min.js

Large diffs are not rendered by default.

Loading

0 comments on commit b883689

Please sign in to comment.