free-jqgrid
Version:
grid as jQuery plugin - fork of jqGrid before licensing change
1,405 lines (1,384 loc) • 331 kB
JavaScript
// ==ClosureCompiler==
// @compilation_level SIMPLE_OPTIMIZATIONS
/**
* @license jqGrid 4.15.5-pre - free jqGrid: https://github.com/free-jqgrid/jqGrid
* Copyright (c) 2008-2014, Tony Tomov, tony@trirand.com
* Copyright (c) 2014-2018, Oleg Kiriljuk, oleg.kiriljuk@ok-soft-gmbh.com
* Dual licensed under the MIT and GPL licenses
* http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl-2.0.html
* Date: 2018-08-12
*/
//jsHint options
/*jshint eqnull:true */
/*jslint browser: true, evil: true, devel: true, white: true */
/*global jQuery, define, HTMLElement, HTMLTableRowElement, module, require */
(function (global, factory) {
"use strict";
if (typeof define === "function" && define.amd) {
// AMD. Register as an anonymous module.
//console.log("grid.base AMD");
define([
"jquery"
], function ($) {
//console.log("grid.base AMD: define callback");
return factory($, global.document);
});
} else if (typeof module === "object" && module.exports) {
// Node/CommonJS
//console.log("grid.base CommonJS");
module.exports = function (root, $) {
//console.log("grid.base CommonJS: in module.exports");
if (!root) {
root = window;
}
//console.log("grid.base CommonJS: before require('jquery')");
if ($ === undefined) {
// require("jquery") returns a factory that requires window to
// build a jQuery instance, we normalize how we use modules
// that require this pattern but the window provided is a noop
// if it's defined (how jquery works)
$ = typeof window !== "undefined" ?
require("jquery") :
require("jquery")(root);
}
//global.jQuery = $;
//root.jQuery = $;
//console.log("grid.base CommonJS: before factory");
factory($, root.document);
return $;
};
} else {
// Browser globals
//console.log("grid.base Browser: before factory");
factory(jQuery, global.document);
}
}(typeof window !== "undefined" ? window : this, function ($, document) {
"use strict";
// begin module grid.base
/** @const */
var englishLanguageDefaults = {
name: "English (United States)",
nameEnglish: "English (United States)",
isRTL: false,
defaults: {
recordtext: "View {0} - {1} of {2}",
emptyrecords: "No records to view",
loadtext: "Loading...",
pgtext: "Page {0} of {1}",
pgfirst: "First Page",
pglast: "Last Page",
pgnext: "Next Page",
pgprev: "Previous Page",
pgrecs: "Records per Page",
showhide: "Toggle Expand Collapse Grid",
savetext: "Saving..."
},
search: {
caption: "Search...",
Find: "Find",
Reset: "Reset",
odata: [
{ oper: "eq", text: "equal" },
{ oper: "ne", text: "not equal" },
{ oper: "lt", text: "less" },
{ oper: "le", text: "less or equal" },
{ oper: "gt", text: "greater" },
{ oper: "ge", text: "greater or equal" },
{ oper: "bw", text: "begins with" },
{ oper: "bn", text: "does not begin with" },
{ oper: "in", text: "is in" },
{ oper: "ni", text: "is not in" },
{ oper: "ew", text: "ends with" },
{ oper: "en", text: "does not end with" },
{ oper: "cn", text: "contains" },
{ oper: "nc", text: "does not contain" },
{ oper: "nu", text: "is null" },
{ oper: "nn", text: "is not null" }
],
groupOps: [
{ op: "AND", text: "all" },
{ op: "OR", text: "any" }
],
addGroupTitle: "Add subgroup",
deleteGroupTitle: "Delete group",
addRuleTitle: "Add rule",
deleteRuleTitle: "Delete rule",
operandTitle: "Click to select search operation.",
resetTitle: "Reset Search Value"
},
edit: {
addCaption: "Add Record",
editCaption: "Edit Record",
bSubmit: "Submit",
bCancel: "Cancel",
bClose: "Close",
saveData: "Data has been changed! Save changes?",
bYes: "Yes",
bNo: "No",
bExit: "Cancel",
msg: {
required: "Field is required",
number: "Please, enter valid number",
minValue: "value must be greater than or equal to ",
maxValue: "value must be less than or equal to",
email: "is not a valid e-mail",
integer: "Please, enter valid integer value",
date: "Please, enter valid date value",
url: "is not a valid URL. Prefix required ('http://' or 'https://')",
nodefined: " is not defined!",
novalue: " return value is required!",
customarray: "Custom function should return array!",
customfcheck: "Custom function should be present in case of custom checking!"
}
},
view: {
caption: "View Record",
bClose: "Close"
},
del: {
caption: "Delete",
msg: "Delete selected record(s)?",
bSubmit: "Delete",
bCancel: "Cancel"
},
nav: {
edittext: "",
edittitle: "Edit selected row",
addtext: "",
addtitle: "Add new row",
deltext: "",
deltitle: "Delete selected row",
searchtext: "",
searchtitle: "Find records",
refreshtext: "",
refreshtitle: "Reload Grid",
alertcap: "Warning",
alerttext: "Please, select row",
viewtext: "",
viewtitle: "View selected row",
savetext: "",
savetitle: "Save row",
canceltext: "",
canceltitle: "Cancel row editing"
},
col: {
caption: "Select columns",
bSubmit: "Ok",
bCancel: "Cancel"
},
errors: {
errcap: "Error",
nourl: "No url is set",
norecords: "No records to process",
model: "Length of colNames <> colModel!"
},
formatter: {
integer: {
thousandsSeparator: ",",
defaultValue: "0"
},
number: {
decimalSeparator: ".",
thousandsSeparator: ",",
decimalPlaces: 2,
defaultValue: "0.00"
},
currency: {
decimalSeparator: ".",
thousandsSeparator: ",",
decimalPlaces: 2,
prefix: "",
suffix: "",
defaultValue: "0.00"
},
date: {
dayNames: [
"Sun", "Mon", "Tue", "Wed", "Thr", "Fri", "Sat",
"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"
],
monthNames: [
"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec",
"January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"
],
AmPm: ["am", "pm", "AM", "PM"],
S: function (j) {
var ending = ["st", "nd", "rd", "th"];
return j < 11 || j > 13 ? ending[Math.min((j - 1) % 10, 3)] : "th";
},
srcformat: "Y-m-d",
newformat: "n/j/Y",
masks: {
// see http://php.net/manual/en/function.date.php for PHP format used in jqGrid
// and see http://docs.jquery.com/UI/Datepicker/formatDate
// and https://github.com/jquery/globalize#dates for alternative formats used frequently
// one can find on https://github.com/jquery/globalize/tree/master/lib/cultures many
// information about date, time, numbers and currency formats used in different countries
// one should just convert the information in PHP format
// short date:
// n - Numeric representation of a month, without leading zeros
// j - Day of the month without leading zeros
// Y - A full numeric representation of a year, 4 digits
// example: 3/1/2012 which means 1 March 2012
ShortDate: "n/j/Y", // in jQuery UI Datepicker: "M/d/yyyy"
// long date:
// l - A full textual representation of the day of the week
// F - A full textual representation of a month
// d - Day of the month, 2 digits with leading zeros
// Y - A full numeric representation of a year, 4 digits
LongDate: "l, F d, Y", // in jQuery UI Datepicker: "dddd, MMMM dd, yyyy"
// long date with long time:
// l - A full textual representation of the day of the week
// F - A full textual representation of a month
// d - Day of the month, 2 digits with leading zeros
// Y - A full numeric representation of a year, 4 digits
// g - 12-hour format of an hour without leading zeros
// i - Minutes with leading zeros
// s - Seconds, with leading zeros
// A - Uppercase Ante meridiem and Post meridiem (AM or PM)
FullDateTime: "l, F d, Y g:i:s A", // in jQuery UI Datepicker: "dddd, MMMM dd, yyyy h:mm:ss tt"
// month day:
// F - A full textual representation of a month
// d - Day of the month, 2 digits with leading zeros
MonthDay: "F d", // in jQuery UI Datepicker: "MMMM dd"
// short time (without seconds)
// g - 12-hour format of an hour without leading zeros
// i - Minutes with leading zeros
// A - Uppercase Ante meridiem and Post meridiem (AM or PM)
ShortTime: "g:i A", // in jQuery UI Datepicker: "h:mm tt"
// long time (with seconds)
// g - 12-hour format of an hour without leading zeros
// i - Minutes with leading zeros
// s - Seconds, with leading zeros
// A - Uppercase Ante meridiem and Post meridiem (AM or PM)
LongTime: "g:i:s A", // in jQuery UI Datepicker: "h:mm:ss tt"
// month with year
// Y - A full numeric representation of a year, 4 digits
// F - A full textual representation of a month
YearMonth: "F, Y" // in jQuery UI Datepicker: "MMMM, yyyy"
}
}
}
};
$.jgrid = $.jgrid || {};
var jgrid = $.jgrid;
jgrid.locales = jgrid.locales || {};
var locales = jgrid.locales;
/**
* Enum with different components of jqGrid.
* @enum {number} @const
*/
/*var INPUT_NAME_TYPE = {
COL_NAME: 0,
ADDITIONAL_PROPERTY: 1,
ROWID: 2
};*/
/**
* Enum with different components of jqGrid.
* @enum {number} @const
*/
var COMPONENT_NAMES = {
// let us this - <table> from which grid is created. Then
// gBox (grid box) - outer div which includes all grid components: $(this).closest(".ui-jqgrid")[0]
// In the same way
GRID_BOX_DIV: 0, // tagName: "div". class: "ui-jqgrid". Id: "gbox_" + gridId
GRID_OVERLAY_DIV: 1, // tagName: "div". class: "jqgrid-overlay". Id: "lui_" + gridId
LOADING_DIV: 2, // tagName: "div". class: "loading". Id: "load_" + gridId
DIALOG_ALERT_DIV: 3, // tagName: "div". class: "ui-jqdialog". Id: "alertmod_" + gridId
DIALOG_SEARCH_DIV: 4, // tagName: "div". class: "ui-jqdialog". Id: "searchmodfbox_" + gridId
DIALOG_VIEW_DIV: 5, // tagName: "div". class: "ui-jqdialog". Id: "viewmod" + gridId
DIALOG_EDIT_DIV: 6, // tagName: "div". class: "ui-jqdialog". Id: "editmod" + gridId
DIALOG_DELETE_DIV: 7, // tagName: "div". class: "ui-jqdialog". Id: "delmod" + gridId
GRID_VIEW_DIV: 8, // tagName: "div". class: "ui-jqgrid-view". Id: "gview_" + gridId
TITLE_BAR_DIV: 9, // tagName: "div". class: "ui-jqgrid-titlebar" and either "ui-jqgrid-caption" or "ui-jqgrid-caption-rtl"
UPPER_TOOLBAR_DIV: 10, // tagName: "div". class: "ui-userdata". Id: "tb_" + gridId
TOP_PAGER_DIV: 11, // tagName: "div". class: "ui-jqgrid-toppager". Id: gridId + "_toppager"
HEADER_DIV: 12, // tagName: "div". class: "ui-jqgrid-hdiv"
HEADER_BOX_DIV: 13, // tagName: "div". class: either "ui-jqgrid-hdiv" or "ui-jqgrid-hbox-rtl"
HEADER_TABLE: 14, // tagName: "table". class: "ui-jqgrid-htable"
HEADER_COLS_ROW: 15, // tagName: "tr". class: "jqgfirstrow" or the row with column headers
HEADER_COLS: 16, // tagName: "th". class: either "ui-first-th-rtl" or "ui-first-th-rtl"
HEADER_ROWS: 47, // tagName: "tr". class: "ui-jqgrid-labels"
HEADER_TH: 48, // tagName: "th". class: "ui-th-column" and either "ui-th-ltr" or "ui-th-rtl"
HEADER_SORTABLE_DIV: 49, // tagName: "div". class: "ui-jqgrid-labels"
HEADER_RESIZABLE_SPAN: 50, // tagName: "span". class: "ui-jqgrid-resize" and either "ui-jqgrid-resize-ltr" or "ui-jqgrid-resize-rtl"
HEADER_SELECT_ALL_ROWS_CHECKBOX: 45, // tagName: "input" (can be changed to "button" in the future). class: "cbox". Id: "cb_" + gridId
SEARCH_TOOLBAR: 17, // tagName: "tr". class: "ui-search-toolbar". Its direct children are th having class "ui-th-column" and optionally "ui-th-rtl"
BODY_DIV: 18, // tagName: "div". class: "ui-jqgrid-bdiv"
BODY_SCROLL_FULL_DIV: 19, // tagName: "div" - It can have height CSS property which simulate the total size of virtual data.
BODY_SCROLL_TOP_DIV: 20, // tagName: "div" - It can have height CSS property which simulate virtual data before the current displayed in btable.
BODY_TABLE: 21, // tagName: "table". class: "ui-jqgrid-btable". Id: gridId
GRID: 21, // tagName: "table". class: "ui-jqgrid-btable". Id: gridId
BODY_COLS_ROW: 22, // tagName: "tr". class: "jqgfirstrow"
BODY_COLS: 23, // tagName: "td"
BODY_DATA_ROWS: 24, // tagName: "tr". class: "jqgrow" and optionally "ui-row-rtl"
FOOTER_DIV: 25, // tagName: "div". class: "ui-jqgrid-sdiv"
FOOTER_BOX_DIV: 26, // tagName: "div". class: either "ui-jqgrid-hdiv" or "ui-jqgrid-hbox-rtl". ??? is it really needed ???
FOOTER_TABLE: 27, // tagName: "table". class: "ui-jqgrid-ftable"
FOOTER_DATA_ROWS: 28, // tagName: "tr". class: "footrow", optionally additionally "footrow-rtl"
BOTTOM_TOOLBAR_DIV: 29, // tagName: "div". class: "ui-userdata". Id: "tb_" + gridId
FROZEN_HEADER_DIV: 30, // tagName: "div". class: "frozen-div" and "ui-jqgrid-hdiv"
// no hBox currently exists
FROZEN_HEADER_TABLE: 31, // tagName: "table". class: "ui-jqgrid-htable"
FROZEN_HEADER_COLS_ROW: 32, // tagName: "tr". class: "jqgfirstrow"
FROZEN_HEADER_COLS: 33, // tagName: "th". class: either "ui-first-th-rtl" or "ui-first-th-rtl"
FROZEN_SEARCH_TOOLBAR: 34, // tagName: "tr". class: "ui-search-toolbar". Its direct children are th having class "ui-th-column" and optionally "ui-th-rtl"
// TODO: fix id of children of .ui-search-input to have no id duplicates with the main grid
FROZEN_FOOTER_DIV: 35, // tagName: "div". class: "frozen-div" and "ui-jqgrid-sdiv"
FROZEN_FOOTER_TABLE: 36, // tagName: "table". class: "ui-jqgrid-ftable"
FROZEN_FOOTER_DATA_ROWS: 37, // tagName: "tr". class: "footrow", optionally additionally "footrow-rtl"
FROZEN_BODY_DIV: 38, // tagName: "div". class: "frozen-div" and "ui-jqgrid-bdiv"
// no full scroll div and top scroll div is currently exist
FROZEN_BODY_TABLE: 39, // tagName: "table". class: "ui-jqgrid-btable". Id: gridId + "_frozen"
FROZEN_BODY_COLS_ROW: 40, // tagName: "tr". class: "jqgfirstrow"
FROZEN_BODY_COLS: 41, // tagName: "td"
FROZEN_BODY_DATA_ROWS: 42, // tagName: "tr". class: "jqgrow" and optionally "ui-row-rtl"
// TODO: fix id of children of .jqgrow to have no id duplicates with the main grid
COLUMN_RESIZER_DIV: 43, // tagName: "div". class: "ui-jqgrid-resize-mark". Id: "rs_m" + gridId
BOTTOM_PAGER_DIV: 44, // tagName: "div". class: "ui-jqgrid-pager"
SEARCH_OPERATION_MENU_UL: 46 // tagName: "ul". class: "ui-search-menu". id="sopt_menu"
};
if (jgrid.defaults == null || $.isEmptyObject(locales) || locales["en-US"] === undefined) {
// set English options only if no grid.locale-XX.js file are included before jquery.jqGrid.min.js or jquery.jqGrid.src.js
// the files included AFTER jquery.jqGrid.min.js or jquery.jqGrid.src.js will just overwrite all the settings which were set previously
// We can set locInfo under $.jgrid additionally to setting under $.jgrid.locales[locale]
// only to have more compatibility with the previous version of jqGrid.
// We don't make this currently.
if (locales["en-US"] === undefined) {
$.extend(true, jgrid, /*englishLanguageDefaults,*/ {
locales: {
"en-US": englishLanguageDefaults // and for English US
}
});
}
jgrid.defaults = jgrid.defaults || {};
if (jgrid.defaults.locale === undefined) {
jgrid.defaults.locale = "en-US";
}
}
jgrid.defaults = jgrid.defaults || {};
var defaults = jgrid.defaults;
//if (jgrid.defaults.locale && locales[jgrid.defaults.locale]) {
// $.extend(true, $.jgrid, locales[jgrid.defaults.locale]); // add to improve compatibility only
//}
$.extend(true, jgrid, {
/** @const */
version: "4.15.5-pre",
/** @const */
productName: "free jqGrid",
defaults: {},
search: {},
edit: {},
view: {},
del: {},
nav: {},
col: {},
errors: {},
formatter: {
unused: "" // used only to detect whether the changes are overwritten because of wrong usage
},
icons: {
jQueryUI: {
common: "ui-icon",
pager: {
first: "ui-icon-seek-first",
prev: "ui-icon-seek-prev",
next: "ui-icon-seek-next",
last: "ui-icon-seek-end"
},
sort: {
asc: "ui-icon-triangle-1-n",
desc: "ui-icon-triangle-1-s"
},
gridMinimize: {
visible: "ui-icon-circle-triangle-n",
hidden: "ui-icon-circle-triangle-s"
},
nav: {
edit: "ui-icon-pencil",
add: "ui-icon-plus",
del: "ui-icon-trash",
search: "ui-icon-search",
refresh: "ui-icon-refresh",
view: "ui-icon-document",
save: "ui-icon-disk",
cancel: "ui-icon-cancel",
newbutton: "ui-icon-newwin"
},
actions: {
edit: "ui-icon-pencil",
del: "ui-icon-trash",
save: "ui-icon-disk",
cancel: "ui-icon-cancel"
},
form: {
close: "ui-icon-closethick",
prev: "ui-icon-triangle-1-w",
next: "ui-icon-triangle-1-e",
save: "ui-icon-disk",
undo: "ui-icon-close",
del: "ui-icon-scissors",
cancel: "ui-icon-cancel",
resizableLtr: "ui-resizable-se ui-icon ui-icon-gripsmall-diagonal-se"
},
search: {
search: "ui-icon-search",
reset: "ui-icon-arrowreturnthick-1-w",
query: "ui-icon-comment"
},
subgrid: {
plus: "ui-icon-plus",
minus: "ui-icon-minus",
openLtr: "ui-icon-caret-1-sw",
openRtl: "ui-icon-caret-1-se"
},
grouping: {
plus: "ui-icon-circlesmall-plus",
minus: "ui-icon-circlesmall-minus"
},
treeGrid: {
minus: "ui-icon-triangle-1-s",
leaf: "ui-icon-radio-off",
plusLtr: "ui-icon-triangle-1-e",
plusRtl: "ui-icon-triangle-1-w"
}
},
fontAwesome: {
common: "fa",
pager: {
common: "fa-fw",
first: "fa-step-backward",
prev: "fa-backward",
next: "fa-forward",
last: "fa-step-forward"
},
sort: {
common: "fa-lg", // common: "",
asc: "fa-sort-asc", // asc: "fa-sort-amount-asc",
desc: "fa-sort-desc" // desc: "fa-sort-amount-desc"
},
gridMinimize: {
visible: "fa-chevron-circle-up",
hidden: "fa-chevron-circle-down"
},
nav: {
common: "fa-lg fa-fw",
edit: "fa-pencil",
add: "fa-plus",
del: "fa-trash-o",
search: "fa-search",
refresh: "fa-refresh",
view: "fa-file-o",
save: "fa-floppy-o",
cancel: "fa-ban",
newbutton: "fa-external-link"
},
actions: {
common: "fa-fw",
edit: "fa-pencil",
del: "fa-trash-o",
save: "fa-floppy-o",
cancel: "fa-ban"
},
form: {
close: "fa-times",
prev: "fa-caret-left",
next: "fa-caret-right",
save: "fa-floppy-o",
undo: "fa-undo",
del: "fa-trash-o",
cancel: "fa-ban",
resizableLtr: "fa-rss fa-rotate-270"
},
search: {
search: "fa-search",
reset: "fa-undo",
query: "fa-comments-o"
},
subgrid: {
common: "fa-fw",
plus: "fa-plus",
minus: "fa-minus",
openLtr: "fa-reply fa-rotate-180",
openRtl: "fa-share fa-rotate-180"
},
grouping: {
common: "fa-fw",
plus: "fa-plus-square-o",
minus: "fa-minus-square-o"
},
treeGrid: {
common: "fa-fw",
minus: "fa-lg fa-sort-desc",
leaf: "fa-dot-circle-o",
plusLtr: "fa-lg fa-caret-right",
plusRtl: "fa-lg fa-caret-left"
},
checkbox: {
checkedClasses: "fa-check-square-o",
checked: "fa-check-square-o fa-lg",
unchecked: "fa-square-o fa-lg"
}
},
fontAwesome5: {
//common: "fas", //"fa"
pager: {
common: "fa-fw",
first: "fa-step-backward",
prev: "fa-backward",
next: "fa-forward",
last: "fa-step-forward"
},
sort: {
common: "fa-lg", // common: "",
asc: "fa-sort-up", //"fa-sort-asc", // asc: "fa-sort-amount-asc",
desc: "fa-sort-down" //"fa-sort-desc" // desc: "fa-sort-amount-desc"
},
gridMinimize: {
visible: "fa-chevron-circle-up",
hidden: "fa-chevron-circle-down"
},
nav: {
common: "fa-lg fa-fw",
edit: "fa-pencil-alt",
add: "fa-plus",
del: "fa-trash-alt",
search: "fa-search",
refresh: "fa-sync", //"fa-refresh",
view: "fa-file",
save: "fa-save",
cancel: "fa-ban",
newbutton: "fa-external-link-alt"
},
actions: {
common: "fa-fw",
edit: "fa-pencil-alt",
del: "fa-trash-alt",
save: "fa-save",
cancel: "fa-ban"
},
form: {
close: "fa-times",
prev: "fa-caret-left",
next: "fa-caret-right",
save: "fa-save",
undo: "fa-undo",
del: "fa-trash-alt",
cancel: "fa-ban",
resizableLtr: "fa-rss fa-lg fa-rotate-270"
},
search: {
search: "fa-search",
reset: "fa-undo",
query: "fa-comments"
},
subgrid: {
common: "fa-fw",
plus: "fa-plus",
minus: "fa-minus",
openLtr: "fa-reply fa-rotate-180",
openRtl: "fa-share fa-rotate-180"
},
grouping: {
common: "fa-fw",
plus: "fa-plus-square",
minus: "fa-minus-square"
},
treeGrid: {
common: "fa-fw",
minus: "fa-lg fa-sort-down", //"fa-lg fa-sort-desc",
leaf: "fa-dot-circle",
plusLtr: "fa-lg fa-caret-right",
plusRtl: "fa-lg fa-caret-left"
},
checkbox: {
ignoreParents: true,
checkedClasses: "fa-check-square",
checked: "far fa-check-square fa-lg",
unchecked: "far fa-square fa-lg"
}
},
fontAwesomeBrands: {
baseIconSet: "fontAwesome5",
common: "fab"
},
fontAwesomeLight: {
baseIconSet: "fontAwesome5",
common: "fal"
},
fontAwesomeRegular: {
baseIconSet: "fontAwesome5",
common: "far"
},
fontAwesomeSolid: {
baseIconSet: "fontAwesome5",
common: "fas"
},
fontAwesomeSVG: {
baseIconSet: "fontAwesome5",
common: "fas"
},
glyph: {
common: "glyphicon",
pager: {
common: "",
first: "glyphicon-step-backward",
prev: "glyphicon-backward",
next: "glyphicon-forward",
last: "glyphicon-step-forward"
},
sort: {
common: "",
asc: "glyphicon-triangle-top",
desc: "glyphicon-triangle-bottom"
},
gridMinimize: {
visible: "glyphicon-circle-arrow-up",
hidden: "glyphicon-circle-arrow-down"
},
nav: {
common: "",
edit: "glyphicon-edit",
add: "glyphicon-plus",
del: "glyphicon-trash",
search: "glyphicon-search",
refresh: "glyphicon-refresh",
view: "glyphicon-file", // glyphicon glyphicon-th-list
save: "glyphicon-save",
cancel: "glyphicon-ban-circle",
newbutton: "glyphicon-new-window"
},
actions: {
common: "",
edit: "glyphicon-edit",
del: "glyphicon-trash",
save: "glyphicon-save",
cancel: "glyphicon-ban-circle"
},
form: {
close: "glyphicon-remove-circle",
prev: "glyphicon-step-backward",
next: "glyphicon-step-forward",
save: "glyphicon-save",
undo: "glyphicon-repeat",
del: "glyphicon-trash",
cancel: "glyphicon-ban-circle",
resizableLtr: "glyphicon-import"
},
search: {
search: "glyphicon-search",
reset: "glyphicon-repeat",
query: "glyphicon-cog" //"glyphicon-comment"
},
subgrid: {
common: "",
plus: "glyphicon-zoom-in", //"glyphicon-plus", "glyphicon-th-list",
minus: "glyphicon-zoom-out", // "glyphicon-minus",
openLtr: "glyphicon-indent-left",
openRtl: "glyphicon-indent-left"
},
grouping: {
common: "",
plus: "glyphicon-expand",
minus: "glyphicon-collapse-down"
},
treeGrid: {
common: "",
minus: "glyphicon-triangle-bottom",
leaf: "glyphicon-record", // glyphicon-unchecked
plusLtr: "glyphicon-triangle-right",
plusRtl: "glyphicon-triangle-left"
},
checkbox: {
checkedClasses: "glyphicon-check",
checked: "glyphicon-check",
unchecked: "glyphicon-unchecked"
}
}
},
guiStyles: {
jQueryUI: {
gBox: "ui-jqgrid-jquery-ui ui-widget ui-widget-content ui-corner-all", // ui-widget-content??? for the children of gbox
gView: "",
overlay: "ui-widget-overlay",
loading: "ui-state-default ui-state-active",
hDiv: "ui-state-default ui-corner-top",
hTable: "",
colHeaders: "ui-state-default",
states: {
select: "ui-state-highlight",
disabled: "ui-state-disabled ui-jqgrid-disablePointerEvents",
hover: "ui-state-hover", // can be table-hover on <table> only and style like .table-hover tbody tr:hover td
error: "ui-state-error",
active: "ui-state-active",
textOfClickable: "ui-state-default"
},
dialog: {
header: "ui-widget-header ui-dialog-titlebar ui-corner-all ui-helper-clearfix",
window: "ui-jqgrid-jquery-ui ui-widget ui-widget-content ui-corner-all ui-front",
document: "",
subdocument: "",
body: "",
footer: "",
content: "ui-widget-content",
hr: "ui-widget-content",
closeButton: "ui-corner-all",
fmButton: "ui-state-default",
dataField: "ui-widget-content ui-corner-all",
viewCellLabel: "ui-widget-content",
viewLabel: "",
viewCellData: "ui-widget-content",
viewData: "",
leftCorner: "ui-corner-left",
rightCorner: "ui-corner-right",
defaultCorner: "ui-corner-all"
},
filterToolbar: {
dataField: "ui-widget-content"
},
subgrid: {
thSubgrid: "ui-state-default", // used only with subGridModel
rowSubTable: "ui-widget-content", // used only with subGridModel additionally to ui-subtblcell
row: "ui-widget-content", // class of the subgrid row, additional to ui-subgrid
tdStart: "", // it can be with span over rownumber and multiselect columns
tdWithIcon: "ui-widget-content", // class of cell with +- icon, additional to subgrid-cell
buttonDiv: "",
button: "",
tdData: "ui-widget-content", // class of main td with span over the grid, additional subgrid-data
legacyTable: ""
},
grid: "",
gridRow: "ui-widget-content",
rowNum: "ui-state-default",
gridFooter: "",
rowFooter: "ui-widget-content",
gridTitle: "ui-widget-header ui-corner-top",
gridError: "ui-state-error",
gridErrorText: "",
titleButton: "ui-corner-all",
toolbarUpper: "ui-state-default",
toolbarBottom: "ui-state-default",
actionsDiv: "ui-widget-content",
actionsButton: "ui-corner-all",
pager: {
pager: "ui-state-default",
pagerButton: "ui-corner-all",
pagerInput: "ui-widget-content",
pagerSelect: "ui-widget-content"
},
navButton: "ui-corner-all",
searchDialog: {
operator: "ui-corner-all",
label: "ui-corner-all",
elem: "ui-corner-all",
operationGroup: "",
addRuleButton: "ui-corner-all",
deleteRuleButton: "ui-corner-all",
operationSelect: "ui-corner-all",
addGroupButton: "ui-corner-all",
deleteGroupButton: "ui-corner-all"
},
searchToolbar: {
menu: "ui-menu-jqueryui ui-menu ui-widget ui-widget-content ui-corner-all",
menuItem: "ui-menu-item",
menuItemButton: "ui-corner-all",
operButton: "ui-corner-all",
clearButton: "ui-corner-all"
},
top: "ui-corner-top",
bottom: "ui-corner-bottom",
resizer: "ui-widget-header"
},
bootstrap: {
gBox: "ui-jqgrid-bootstrap",
gView: "panel-info",
overlay: "modal-backdrop",
loading: "alert alert-info",
hDiv: "",
hTable: "table table-hover table-condensed table-bordered",
colHeaders: "",
states: {
select: "success",
disabled: "disabled ui-jqgrid-disablePointerEvents",
hover: "active",
error: "danger",
active: "active",
textOfClickable: ""
},
dialog: {
header: "modal-header",
window: "modal ui-jqgrid-bootstrap",
document: "modal-dialog",
subdocument: "modal-content",
body: "modal-body",
footer: "modal-footer",
content: "modal-content",
hr: "hidden",
closeButton: "btn btn-xs btn-default",
fmButton: "btn btn-default",
dataField: "form-control",
viewCellLabel: "",
viewLabel: "control-label",
viewCellData: "",
viewData: "form-control",
leftCorner: "",
rightCorner: "",
defaultCorner: ""
},
filterToolbar: {
dataField: "form-control"
},
subgrid: {
thSubgrid: "",
rowSubTable: "",
row: "",
tdStart: "",
tdWithIcon: "",
buttonDiv: "",
button: "btn btn-xs",
tdData: "",
legacyTable: "table table-condensed table-hover table-bordered"
},
grid: "table table-condensed table-hover table-bordered",
gridRow: "",
rowNum: "",
gridFooter: "table table-hover table-condensed table-bordered",
rowFooter: "",
gridTitle: "",
gridError: "alert alert-danger",
gridErrorText: "sr-only",
titleButton: "btn btn-xs btn-default",
actionsDiv: "",
actionsButton: "btn btn-xs btn-default",
toolbarUpper: "",
toolbarBottom: "",
pager: {
pager: "panel-footer",
pagerButton: "btn btn-xs",
pagerInput: "form-control",
pagerSelect: "form-control"
},
navButton: "btn btn-xs",
searchDialog: {
operator: "form-control",
label: "form-control",
elem: "form-control",
operationGroup: "form-inline",
addRuleButton: "btn btn-xs btn-default",
deleteRuleButton: "btn btn-xs btn-default",
operationSelect: "form-control",
addGroupButton: "btn btn-xs btn-default",
deleteGroupButton: "btn btn-xs btn-default"
},
searchToolbar: {
menu: "dropdown-menu",
menuItem: "",
menuItemButton: "ui-corner-all",
operButton: "btn btn-xs btn-default",
clearButton: "btn btn-xs btn-default"
},
top: "ui-jqgrid-bootstrap-corner-top",
bottom: "ui-jqgrid-bootstrap-corner-bottom",
resizer: "ui-jqgrid-bootstrap"
},
bootstrapPrimary: {
baseGuiStyle: "bootstrap",
dialog: {
closeButton: "btn btn-xs close",
fmButton: "btn btn-primary"
},
searchDialog: {
addRuleButton: "btn btn-xs btn-primary",
deleteRuleButton: "btn btn-xs btn-primary",
addGroupButton: "btn btn-xs btn-primary",
deleteGroupButton: "btn btn-xs btn-primary"
}
},
bootstrap4: {
gBox: "ui-jqgrid-bootstrap",
gView: "card",
overlay: "modal-backdrop",
loading: "alert alert-info",
hDiv: "",
hTable: "table table-hover table-sm table-bordered",
colHeaders: "",
states: {
select: "table-success",
disabled: "disabled ui-jqgrid-disablePointerEvents",
hover: "active",
hoverTh: "table-active",
error: "danger",
active: "active",
textOfClickable: ""
},
dialog: {
header: "modal-header",
window: "modal ui-jqgrid-bootstrap",
document: "modal-dialog",
subdocument: "modal-content",
body: "modal-body",
footer: "modal-footer",
content: "modal-content",
hr: "d-none",
closeButton: "btn btn-xs btn-outline-primary",
fmButton: "btn btn-outline-secondary",
dataField: "form-control",
viewCellLabel: "",
viewLabel: "control-label",
viewCellData: "",
viewData: "form-control",
leftCorner: "",
rightCorner: "",
defaultCorner: ""
},
filterToolbar: {
dataField: "form-control"
},
subgrid: {
thSubgrid: "",
rowSubTable: "",
row: "",
tdStart: "",
tdWithIcon: "",
buttonDiv: "",
button: "btn btn-xs",
tdData: "",
legacyTable: "table table-condensed table-hover table-bordered"
},
grid: "table table-condensed table-hover table-bordered",
gridRow: "",
rowNum: "",
gridFooter: "table table-hover table-condensed table-bordered",
rowFooter: "",
gridTitle: "",
gridError: "alert alert-danger",
gridErrorText: "sr-only",
titleButton: "btn btn-xs btn-outline-primary",
actionsDiv: "",
actionsButton: "btn btn-xs btn-outline-secondary",
toolbarUpper: "",
toolbarBottom: "",
pager: {
pager: "card-footer",
pagerButton: "btn btn-xs",
pagerInput: "form-control",
pagerSelect: "form-control"
},
navButton: "btn btn-xs",
searchDialog: {
operator: "form-control",
label: "form-control",
elem: "form-control",
operationGroup: "form-inline",
addRuleButton: "btn btn-xs btn-default",
deleteRuleButton: "btn btn-xs btn-default",
operationSelect: "form-control",
addGroupButton: "btn btn-xs btn-default",
deleteGroupButton: "btn btn-xs btn-default"
},
searchToolbar: {
menu: "dropdown-menu",
menuItem: "",
menuItemButton: "dropdown-item",
operButton: "btn btn-xs btn-outline-secondary",
clearButton: "btn btn-xs btn-outline-secondary"
},
top: "ui-jqgrid-bootstrap-corner-top",
bottom: "ui-jqgrid-bootstrap-corner-bottom",
resizer: "ui-jqgrid-bootstrap"
}
},
htmlDecode: function (value) {
if (value && (value === " " ||
value === " " ||
(value.length === 1 && value.charCodeAt(0) === 160))) {
return "";
}
return !value ?
value :
String(value)
.replace(/>/g, ">")
.replace(/</g, "<")
.replace(/'/g, "'")
.replace(///g, "\/")
.replace(/'/g, "'")
.replace(///g, "\/")
.replace(/"/g, "\"")
.replace(/&/g, "&");
},
htmlEncode: function (value) {
// see https://www.owasp.org/index.php/XSS_(Cross_Site_Scripting)_Prevention_Cheat_Sheet#RULE_.231_-_HTML_Escape_Before_Inserting_Untrusted_Data_into_HTML_Element_Content
return !value ?
value :
String(value)
.replace(/&/g, "&")
.replace(/"/g, """)
.replace(/'/g, "'")
.replace(/\//g, "/")
.replace(/</g, "<")
.replace(/>/g, ">");
},
oldEncodePostedData: function (value) {
return !value ?
value :
String(value)
.replace(/&/g, "&")
.replace(/"/g, """)
.replace(/</g, "<")
.replace(/>/g, ">");
},
oldDecodePostedData: function (value) {
if (value && (value === " " ||
value === " " ||
(value.length === 1 && value.charCodeAt(0) === 160))) {
return "";
}
return !value ?
value :
String(value)
.replace(/>/g, ">")
.replace(/</g, "<")
.replace(/"/g, "\"")
.replace(/&/g, "&");
},
clearArray: function (ar) {
// see http://jsperf.com/empty-javascript-array
while (ar.length > 0) {
ar.pop();
}
},
format: function (format) { //jqgformat
var args = $.makeArray(arguments).slice(1);
if (format == null) { format = ""; }
return format.replace(/\{(\d+)\}/g, function (m, i) {
return args[i];
});
},
template: function (format) { //jqgformat
var args = $.makeArray(arguments).slice(1), j, al = args.length;
if (format == null) {
format = "";
}
return format.replace(/\{([\w\-]+)(?:\:([\w\.]*)(?:\((\.*?)?\))?)?\}/g, function (m, i) {
var nmarr, k;
if (!isNaN(parseInt(i, 10))) {
return args[parseInt(i, 10)];
}
for (j = 0; j < al; j++) {
if ($.isArray(args[j])) {
nmarr = args[j];
k = nmarr.length;
while (k--) {
if (i === nmarr[k].nm) {
return nmarr[k].v;
}
}
}
}
});
},
msie: navigator.appName === "Microsoft Internet Explorer",
msiever: function () {
// Trident/4.0 - Internet Explorer 8,
// Trident/5.0 - Internet Explorer 9,
// Trident/6.0 - Internet Explorer 10
// Trident/7.0 - IE11
// Version tokens MSIE might not reflect the actual version of the browser
// If Compatibility View is enabled for a webpage or the browser mode is set to an earlier version
var rv = -1, match;
if (navigator.appName === "Microsoft Internet Explorer") {
match = /(MSIE) ([0-9]{1,}[.0-9]{0,})/.exec(navigator.userAgent);
if (match != null && match.length === 3) {
rv = parseFloat(match[2] || -1);
}
} else if (navigator.appName === "Netscape") {
match = /rv:([0-9]{1,}[.0-9]{0,})/.exec(navigator.userAgent);
if (match != null && match.length === 2) {
rv = parseFloat(match[1] || -1);
}
}
return rv;
},
fixMaxHeightOfDiv: function (height) {
// we place the fixing of maximal height in the method to allow easy
// to overwrite the method and to change the behaviour of jqGrid
// in case of usage virtual scrolling
if (navigator.appName === "Microsoft Internet Explorer") {
return Math.min(height, 1533917); // ??? 1022611
}
if (/(Firefox)/.exec(navigator.userAgent) != null) {
return Math.min(height, 17895696);
}
return height;
},
getRelativeRect: function (elem) {
var relativeTo = elem instanceof $ && elem.length > 0 ? elem[0] : elem,
relativeToOuterHeight = $(relativeTo).outerHeight(),
gbox = $(this).closest(".ui-jqgrid")[0],
rectRelativeTo, rectGbox;
if (!gbox) {
return { top: 0, left: 0 };
}
rectRelativeTo = relativeTo.getBoundingClientRect != null ?
relativeTo.getBoundingClientRect() :
$(relativeTo).offset();
rectGbox = gbox.getBoundingClientRect != null ?
gbox.getBoundingClientRect() :
$(gbox).offset();
return {
top: rectRelativeTo.top + relativeToOuterHeight - rectGbox.top,
//right: rectGbox.right - rectRelativeTo.right,
left: rectRelativeTo.left - rectGbox.left
};
},
getCellIndex: function (cell) {
var c = $(cell);
if (c.is("tr")) { return -1; }
c = (!c.is("td") && !c.is("th") ? c.closest("td,th") : c)[0];
if (c == null) { return -1; }
if (jgrid.msie) { return $.inArray(c, c.parentNode.cells); }
return c.cellIndex;
},
stripHtml: function (v) {
v = String(v);
if (v) {
v = v.replace(/<("[^"]*"|'[^']*'|[^'">])*>/gi, "");
return (v && v !== " " && v !== " ") ? v.replace(/"/g, "'") : "";
}
return v;
},
stripPref: function (pref, id) {
var obj = $.type(pref);
if (obj === "string" || obj === "number") {
pref = String(pref);
id = pref !== "" ? String(id).replace(String(pref), "") : id;
}
return id;
},
getRes: function (basePath, path) {
var pathParts = path.split("."), n = pathParts.length, i;
if (basePath == null) {
return undefined;
}
for (i = 0; i < n; i++) {
if (!pathParts[i]) {
return null;
}
basePath = basePath[pathParts[i]];
if (basePath === undefined) {
break;
}
if (typeof basePath === "string") {
return basePath;
}
}
return basePath;
},
parseDate: function (format, date, newformat, opts) {
// It seems that the code was "imported" by Tony from http://blog.stevenlevithan.com/archives/date-time-format
// Thus I include the reference to original
// Date Format 1.2.3 (c) 2007-2009 Steven Levithan <stevenlevithan.com> MIT license
// The code can be found on https://github.com/felixge/node-dateformat/blob/master/lib/dateformat.js
// It would be probabbly good idea to support original date format additionally to the
// PHP data format used below.
var token = /\\.|[dDjlNSwzWFmMntLoYyaABgGhHisueIOPTZcrU]/g, dM, k, hl, timestamp = 0, offset = 0,
timezone = /\b(?:[PMCEA][SDP]T|(?:Pacific|Mountain|Central|Eastern|Atlantic) (?:Standard|Daylight|Prevailing) Time|(?:GMT|UTC)(?:[\-+]\d{4})?)\b/g,
timezoneClip = /[^\-+\dA-Z]/g,
msMatch = ((typeof date === "string") ? date.match(/^\/Date\((([\-+])?[0-9]+)(([\-+])([0-9]{2})([0-9]{2}))?\)\/$/) : null),
pad = function (value, length) {
value = String(value);
length = parseInt(length, 10) || 2;
while (value.length < length) { value = "0" + value; }
return value;
},
ts = { m: 1, d: 1, y: 1970, h: 0, i: 0, s: 0, u: 0 },
h12To24 = function (ampm, h) {
if (ampm === 0) {
if (h === 12) { h = 0; }
} else {
if (h !== 12) { h += 12; }
}
return h;
},
getDefOptions = function (p, options) {
// It could be multiple sources for date properties used below.
// Let us we need to use srcformat. The highest priority have
// opts.srcformat if it is specified. If the srcformat is not
// specified of if opts is undefined then one should use
// $.jgrid.locales.de.formatter.date.srcformat, for example,
// where "de" part is an example of the locale of the grid
// ($t.p.locale). There as the third important case existing
// because of compatibility only. The old place for formatter.date.srcformat
// was $.jgrid.formatter.date.srcformat (without "locales.de" part
// in the middle). Now such option should be not used, but
// because of some code where the old code of jqGrid was customized
// using $.jgrid.formatter instead of $.jgrid.locales[locale].formatter,
// one have to take in consideration the case. If such setting exist
// then one should use it (should use $.jgrid.formatter.date.srcformat)
// BEFORE the new default $.jgrid.locales.de.formatter.date.srcformat.
// As the result sue should search for all below properties in 3 sources:
// first in opts || {}, second in
// ($.jgrid.formatter || {}).date || {}
// and finally, if $t.p != null && $t.p.locale != null, under
// $.jgrid.locales[$t.p.locale].formatter.date
// oder (it's the same, just rewritten) under
// ((locales[$t.p.locale] || {}).formatter || {}).date
var props = ["AmPm", "dayNames", "masks", "monthNames", "userLocalTime", "parseRe", "S", "srcformat"],
root1 = options || {},
root2 = (jgrid.formatter || {}).date || {},
root3 = ((locales[(p || $.jgrid.defaults).locale] || {}).formatter || {}).date,
iProp, nProps = props.length, result = {}, prop;
for (iProp = 0; iProp < nProps; iProp++) {
prop = props[iProp];
if (root1[prop] !== undefined) { // root1.hasOwnProperty(prop)
result[prop] = root1[prop];
} else if (root2[prop] !== undefined) {// root2.hasOwnProperty(prop)
result[prop] = root2[prop];
} else if (root3[prop] !== undefined) {// root3.hasOwnProperty(prop)
result[prop] = root3[prop];
}
}
return result;
};
//opts = $.extend({}, (jgrid.formatter || {}).date,
// $t.p != null ?
// jgrid.getRes(locales[$t.p.locale], "formatter.date") || {} :
// {},
// opts || {});
opts = getDefOptions(this.p, opts);
// old lang files
if (opts.parseRe === undefined) {
opts.parseRe = /[#%\\\/:_;.,\t\s\-]/;
}
if (opts.masks.hasOwnProperty(format)) { format = opts.masks[format]; }
if (date && date != null) {
if (!isNaN(date) && String(format).toLowerCase() === "u") {
//Unix timestamp
timestamp = new Date(parseFloat(date) * 1000);
} else if (!isNaN(date) && String(format).toLowerCase() === "u1000") {
// Milliseconds since the Unix Epoch (January 1 1970 00:00:00 GMT)
timestamp = new Date(parseFloat(date));
} else if (date.constructor === Date) {
timestamp = date;
// Microsoft date format support
} else if (msMatch !== null) {
timestamp = new Date(parseInt(msMatch[1], 10));
if (msMatch[3]) {
offset = Number(msMatch[5]) * 60 + Number(msMatch[6]);
offset *= ((msMatch[4] === "-") ? 1 : -1);
offset -= timestamp.getTimezoneOffset();
timestamp.setTime(Number(Number(timestamp) + (offset * 60 * 1000)));
}
} else {
//Support ISO8601Long that have Z at the end to indicate UTC timezone
if (opts.srcformat === "ISO8601Long" && date.charAt(date.length - 1) === "Z") {
offset -= (new Date()).getTimezoneOffset();
}
date = String(date).replace(/\T/g, "#").replace(/\t/, "%").split(opts.parseRe);
format = format.replace(/\T/g, "#").replace(/\t/, "%").split(opts.parseRe);
// parsing for month names and time
for (k = 0, hl = Math.min(format.length, date.length); k < hl; k++) {
switch (format[k]) {
case "M":
// A short textual representation of a month, three letters Jan through Dec
dM = $.inArray(date[k], opts.monthNames);
if (dM !== -1 && dM < 12) {
date[k] = dM + 1;
ts.m = date[k];
}
break;
case "F":
// A full textual representation of a month, such as January or March
dM = $.inArray(date[k], opts.monthNames, 12);
if (dM !== -1 && dM > 11) {
date[k] = dM + 1 - 12;
ts.m = date[k];
}
break;
case "n":
// Numeric representation of a month, without leading zeros 1 through 12
ts.m = parseInt(date[k], 10);
break;
case "j":
// Day of the month without leading zeros 1 to 31
ts.d = parseInt(date[k], 10);
break;
case "g":
// 12-hour format of an hour without leading zeros 1 through 12
ts.h = parseInt(date[k], 10);
break;
case "a":
// Lowercase Ante meridiem and Post meridiem am or pm
dM = $.inArray(date[k], opts.AmPm);
if (dM !== -1 && dM < 2 && date[k] === opts.AmPm[dM]) {
date[k] = dM;
ts.h = h12To24(date[k], ts.h);
}
break;
case "A":
// Uppercase Ante meridiem and Post meridiem AM or PM
dM = $.inArray(date[k], opts.AmPm);
if (dM !== -1 && dM > 1 && date[k] === opts.AmPm[dM]) {
date[k] = dM - 2;
ts.h = h12To24(date[k], ts.h);
}
break;
}
if (date[k] !== undefined && date[k] !== "" && !isNaN(date[k])) {
ts[format[k].toLowerCase()] = parseInt(date[k], 10);
}
}
if (ts.f) { ts.m = ts.f; }
if (ts.m === 0 && ts.y === 0 && ts.d === 0) {
return " ";
}
ts.m = parseInt(ts.m, 10) - 1;
var ty = ts.y;
if (ty >= 70 && ty <= 99) {
ts.y = 1900 + ts.y;
} else if (ty >= 0 && ty <= 69) {
ts.y = 2000 + ts.y;
}
timestamp = new Date(ts.y, ts.m, ts.d, ts.h, ts.i, ts.s, ts.u);
//Apply offset to show date as local time.
if (offset !== 0) {
timestamp.setTime(Number(Number(timestamp) + (offset * 60 * 1000)));
}
}
} else {
timestamp = new Date(ts.y, ts.m, ts.d, ts.h, ts.i, ts.s, ts.u);
}
if (opts.userLocalTime && offset === 0) {
offset -= (new Date()).getTimezoneOffset();
if (offset !== 0) {
timestamp.setTime(Number(Number(timestamp) + (offset * 60 * 1000)));
}
}
if (newformat === undefined) {
return timestamp;
}
if (opts.masks.hasOwnProperty(newformat)) {
newformat = opts.masks[newformat];
} else if (!newformat) {
newformat = "Y-m-d";
}
if (newformat.toLowerCase() === "u1000") {
return timestamp.getTime();
}
var hours = timestamp.getHours(), // a Number, from 0 to 23, representing the hour
i = timestamp.getMinutes(),
j = timestamp.getDate(),
n = timestamp.getMonth() + 1,
o = timestamp.getTimezoneOffset(),
s = timestamp.getSeconds(),
u = timestamp.getMilliseconds(),
w = timestamp.getDay(),
year = timestamp.getFullYear(), // a Number, representing four digits, representing the year. Examples: 1999 or 2003
dayOfWeek = (w + 6) % 7 + 1, // numeric representation of the day of the week. 1 (for Monday) through 7 (for Sunday)
z = (new Date(year, n - 1, j) - new Date(year, 0, 1)) / 86400000,
weekNumberOfYear = dayOfWeek < 5 ?
Math.floor((z + dayOfWeek - 1) / 7) + 1 :
Math.floor((z + dayOfWeek - 1) / 7) || ((new Date(year - 1, 0, 1).getDay() + 6) % 7 < 4 ? 53 : 52),
flags = {
// Day
d: pad(j)