feature: choose which noticeboard components to display with the link builder
also restyle noticeboard using flex
This commit is contained in:
@@ -284,6 +284,17 @@
|
||||
|
||||
$.each(queryStringParameters, function (key, value) {
|
||||
switch (key.toLowerCase()) {
|
||||
case 'components':
|
||||
const showComponents = value.split(",");
|
||||
if (showComponents.length > 0) {
|
||||
const components = ['inProcess', 'readyForReturn', 'waitingForUserAction'];
|
||||
components.forEach(function (component) {
|
||||
if (!showComponents.includes(component)) {
|
||||
$('body').addClass('hide-' + component);
|
||||
}
|
||||
});
|
||||
}
|
||||
break;
|
||||
case 'theme': // THEME
|
||||
setTheme(value);
|
||||
fixedTheme = value;
|
||||
|
||||
@@ -344,100 +344,109 @@ WriteLiteral("\', null, function (data) {\r\n\r\n var inProce
|
||||
"ryStringParameters();\r\n\r\n if (queryStringParameters !== null) {\r\n" +
|
||||
" var filters = [];\r\n\r\n $.each(queryStringP" +
|
||||
"arameters, function (key, value) {\r\n switch (key.toLowerC" +
|
||||
"ase()) {\r\n case \'theme\': // THEME\r\n " +
|
||||
" setTheme(value);\r\n fixedTheme = val" +
|
||||
"ue;\r\n break;\r\n case \'d" +
|
||||
"eviceaddressinclude\': // FILTER: Device Address Include\r\n " +
|
||||
" var deviceAddresses = value.split(\",\").map(function (v) { return v.toLo" +
|
||||
"werCase(); });\r\n if (deviceAddresses.length > 0) " +
|
||||
"{\r\n filters.push(function (heldDeviceItem) {\r" +
|
||||
"\n // false if DeviceAddressShortName is n" +
|
||||
"ull\r\n if (!heldDeviceItem.DeviceAddressSh" +
|
||||
"ortName)\r\n return false;\r\n\r\n " +
|
||||
" // true if DeviceAddressShortName is included\r\n " +
|
||||
" return $.inArray(heldDeviceItem.DeviceAddr" +
|
||||
"essShortName.toLowerCase(), deviceAddresses) >= 0;\r\n " +
|
||||
" });\r\n }\r\n " +
|
||||
"break;\r\n case \'deviceaddressexclude\': // FILTER: Devi" +
|
||||
"ce Address Exclude\r\n var deviceAddresses = value." +
|
||||
"split(\",\").map(function (v) { return v.toLowerCase(); });\r\n " +
|
||||
" if (deviceAddresses.length > 0) {\r\n " +
|
||||
" filters.push(function (heldDeviceItem) {\r\n " +
|
||||
" // true if DeviceAddressShortName is null\r\n " +
|
||||
" if (!heldDeviceItem.DeviceAddressShortName)\r\n " +
|
||||
" return true;\r\n\r\n // true " +
|
||||
"if DeviceAddressShortName is excluded\r\n r" +
|
||||
"eturn $.inArray(heldDeviceItem.DeviceAddressShortName.toLowerCase(), deviceAddre" +
|
||||
"sses) < 0;\r\n });\r\n " +
|
||||
" }\r\n break;\r\n case" +
|
||||
" \'deviceprofileinclude\': // FILTER: Device Profile Include\r\n " +
|
||||
" var deviceProfiles = value.split(\",\").map(function (v) { return pars" +
|
||||
"eInt(v); });\r\n if (deviceProfiles.length > 0) {\r\n" +
|
||||
" filters.push(function (heldDeviceItem) {\r\n " +
|
||||
" // true if DeviceProfileId is included\r\n " +
|
||||
" return $.inArray(heldDeviceItem.DeviceProf" +
|
||||
"ileId, deviceProfiles) >= 0;\r\n });\r\n " +
|
||||
" }\r\n break;\r\n " +
|
||||
" case \'deviceprofileexclude\': // FILTER: Device Profile Exclude\r\n " +
|
||||
" var deviceProfiles = value.split(\",\").map(function" +
|
||||
" (v) { return parseInt(v); });\r\n if (deviceProfil" +
|
||||
"es.length > 0) {\r\n filters.push(function (hel" +
|
||||
"dDeviceItem) {\r\n // true if DeviceProfile" +
|
||||
"Id is excluded\r\n return $.inArray(heldDev" +
|
||||
"iceItem.DeviceProfileId, deviceProfiles) < 0;\r\n " +
|
||||
" });\r\n }\r\n break" +
|
||||
";\r\n }\r\n });\r\n\r\n if " +
|
||||
"(filters.length > 0)\r\n itemFilters = filters;\r\n " +
|
||||
" else\r\n itemFilters = null;\r\n }\r\n" +
|
||||
" }\r\n\r\n function connectionError() {\r\n try {" +
|
||||
"\r\n $(\'body\').addClass(\'status-error\');\r\n $" +
|
||||
".connection.hub.stop();\r\n } catch (e) {\r\n // I" +
|
||||
"gnore\r\n }\r\n\r\n window.setTimeout(function () {\r\n " +
|
||||
" window.location.reload(true);\r\n }, 10000);\r\n " +
|
||||
" }\r\n\r\n // Helpers\r\n function rotateArray(koArray, e" +
|
||||
"lement) {\r\n var items = koArray();\r\n\r\n if (items.l" +
|
||||
"ength <= 1)\r\n return 0;\r\n\r\n if (element.height" +
|
||||
"() < (element.parent().height() - 30)) {\r\n\r\n if (findUnsorted" +
|
||||
"ArrayTopIndex(items) !== 0)\r\n koArray.sort(sortFunction);" +
|
||||
"\r\n\r\n // Don\'t rotate if small & sorted correctly\r\n " +
|
||||
" return;\r\n }\r\n\r\n // Move Last Item to Top\r" +
|
||||
"\n var item = koArray.pop();\r\n koArray.unshift(item" +
|
||||
");\r\n }\r\n function removeItemFromArray(koArray, deviceSeria" +
|
||||
"lNumber) {\r\n var items = koArray();\r\n for (var i =" +
|
||||
" 0; i < items.length; i++) {\r\n if (items[i].DeviceSerialNumbe" +
|
||||
"r == deviceSerialNumber) {\r\n koArray.splice(i, 1);\r\n " +
|
||||
" items = koArray();\r\n i--;\r\n " +
|
||||
" }\r\n }\r\n }\r\n function findUnsortedA" +
|
||||
"rrayTopIndex(items) {\r\n // Only one Item\r\n if (ite" +
|
||||
"ms.length <= 1)\r\n return 0;\r\n\r\n for (var i = 1" +
|
||||
"; i < items.length; i++) {\r\n var s = sortFunction(items[i - 1" +
|
||||
"], items[i]);\r\n if (s > 0)\r\n return i;" +
|
||||
"\r\n }\r\n\r\n return 0;\r\n }\r\n fun" +
|
||||
"ction findSortedInsertIndex(koArray, heldDeviceItem) {\r\n var item" +
|
||||
"s = koArray();\r\n var startIndex = findUnsortedArrayTopIndex(items" +
|
||||
");\r\n for (var i = startIndex; i < items.length; i++) {\r\n " +
|
||||
" var s = sortFunction(heldDeviceItem, items[i]);\r\n " +
|
||||
"if (s <= 0)\r\n return i;\r\n }\r\n " +
|
||||
" if (startIndex !== 0) {\r\n for (var i = 0; i < startIndex; " +
|
||||
"i++) {\r\n var s = sortFunction(heldDeviceItem, items[i]);\r" +
|
||||
"\n if (s <= 0)\r\n return i;\r\n " +
|
||||
" }\r\n return startIndex;\r\n } el" +
|
||||
"se {\r\n return -1;\r\n }\r\n }\r\n " +
|
||||
" function sortFunction(l, r) {\r\n return l.DeviceDescription.to" +
|
||||
"LowerCase() == r.DeviceDescription.toLowerCase() ? 0 : (l.DeviceDescription.toLo" +
|
||||
"werCase() < r.DeviceDescription.toLowerCase() ? -1 : 1)\r\n }\r\n " +
|
||||
" function isInProcess(i) {\r\n return !i.ReadyForReturn && !i.Wa" +
|
||||
"itingForUserAction;\r\n }\r\n function isReadyForReturn(i) {\r\n" +
|
||||
" return i.ReadyForReturn && !i.WaitingForUserAction;\r\n " +
|
||||
" }\r\n function isWaitingForUserAction(i) {\r\n return i.W" +
|
||||
"aitingForUserAction;\r\n }\r\n function getQueryStringParamete" +
|
||||
"rs() {\r\n\r\n if (window.location.search.length === 0)\r\n " +
|
||||
" return null;\r\n\r\n var params = {};\r\n window" +
|
||||
".location.search.substr(1).split(\"&\").forEach(function (pair) {\r\n " +
|
||||
" if (pair === \"\") return;\r\n var parts = pair.split(\"=\");\r" +
|
||||
"\n params[parts[0]] = parts[1] && decodeURIComponent(parts[1]." +
|
||||
"replace(/\\+/g, \" \"));\r\n });\r\n return params;\r\n " +
|
||||
" }\r\n\r\n init();\r\n });\r\n </script>\r\n</body>\r\n</html>");
|
||||
"ase()) {\r\n case \'components\':\r\n " +
|
||||
" const showComponents = value.split(\",\");\r\n " +
|
||||
" if (showComponents.length > 0) {\r\n const " +
|
||||
"components = [\'inProcess\', \'readyForReturn\', \'waitingForUserAction\'];\r\n " +
|
||||
" components.forEach(function (component) {\r\n " +
|
||||
" if (!showComponents.includes(component)) {\r\n " +
|
||||
" $(\'body\').addClass(\'hide-\' + component);\r\n" +
|
||||
" }\r\n }" +
|
||||
");\r\n }\r\n break;\r\n " +
|
||||
" case \'theme\': // THEME\r\n " +
|
||||
" setTheme(value);\r\n fixedTheme = value;\r\n " +
|
||||
" break;\r\n case \'deviceaddres" +
|
||||
"sinclude\': // FILTER: Device Address Include\r\n va" +
|
||||
"r deviceAddresses = value.split(\",\").map(function (v) { return v.toLowerCase(); " +
|
||||
"});\r\n if (deviceAddresses.length > 0) {\r\n " +
|
||||
" filters.push(function (heldDeviceItem) {\r\n " +
|
||||
" // false if DeviceAddressShortName is null\r\n " +
|
||||
" if (!heldDeviceItem.DeviceAddressShortName)\r\n " +
|
||||
" return false;\r\n\r\n " +
|
||||
" // true if DeviceAddressShortName is included\r\n " +
|
||||
" return $.inArray(heldDeviceItem.DeviceAddressShortNam" +
|
||||
"e.toLowerCase(), deviceAddresses) >= 0;\r\n });" +
|
||||
"\r\n }\r\n break;\r\n " +
|
||||
" case \'deviceaddressexclude\': // FILTER: Device Address " +
|
||||
"Exclude\r\n var deviceAddresses = value.split(\",\")." +
|
||||
"map(function (v) { return v.toLowerCase(); });\r\n " +
|
||||
"if (deviceAddresses.length > 0) {\r\n filters.p" +
|
||||
"ush(function (heldDeviceItem) {\r\n // true" +
|
||||
" if DeviceAddressShortName is null\r\n if (" +
|
||||
"!heldDeviceItem.DeviceAddressShortName)\r\n " +
|
||||
" return true;\r\n\r\n // true if DeviceAd" +
|
||||
"dressShortName is excluded\r\n return $.inA" +
|
||||
"rray(heldDeviceItem.DeviceAddressShortName.toLowerCase(), deviceAddresses) < 0;\r" +
|
||||
"\n });\r\n }\r\n " +
|
||||
" break;\r\n case \'devicepro" +
|
||||
"fileinclude\': // FILTER: Device Profile Include\r\n " +
|
||||
" var deviceProfiles = value.split(\",\").map(function (v) { return parseInt(v); })" +
|
||||
";\r\n if (deviceProfiles.length > 0) {\r\n " +
|
||||
" filters.push(function (heldDeviceItem) {\r\n " +
|
||||
" // true if DeviceProfileId is included\r\n " +
|
||||
" return $.inArray(heldDeviceItem.DeviceProfileId, devi" +
|
||||
"ceProfiles) >= 0;\r\n });\r\n " +
|
||||
" }\r\n break;\r\n " +
|
||||
" case \'deviceprofileexclude\': // FILTER: Device Profile Exclude\r\n " +
|
||||
" var deviceProfiles = value.split(\",\").map(function (v) { retu" +
|
||||
"rn parseInt(v); });\r\n if (deviceProfiles.length >" +
|
||||
" 0) {\r\n filters.push(function (heldDeviceItem" +
|
||||
") {\r\n // true if DeviceProfileId is exclu" +
|
||||
"ded\r\n return $.inArray(heldDeviceItem.Dev" +
|
||||
"iceProfileId, deviceProfiles) < 0;\r\n });\r\n " +
|
||||
" }\r\n break;\r\n " +
|
||||
" }\r\n });\r\n\r\n if (filters.le" +
|
||||
"ngth > 0)\r\n itemFilters = filters;\r\n e" +
|
||||
"lse\r\n itemFilters = null;\r\n }\r\n " +
|
||||
" }\r\n\r\n function connectionError() {\r\n try {\r\n " +
|
||||
" $(\'body\').addClass(\'status-error\');\r\n $.connection" +
|
||||
".hub.stop();\r\n } catch (e) {\r\n // Ignore\r\n " +
|
||||
" }\r\n\r\n window.setTimeout(function () {\r\n " +
|
||||
" window.location.reload(true);\r\n }, 10000);\r\n }\r\n" +
|
||||
"\r\n // Helpers\r\n function rotateArray(koArray, element) {\r\n" +
|
||||
" var items = koArray();\r\n\r\n if (items.length <= 1)" +
|
||||
"\r\n return 0;\r\n\r\n if (element.height() < (eleme" +
|
||||
"nt.parent().height() - 30)) {\r\n\r\n if (findUnsortedArrayTopInd" +
|
||||
"ex(items) !== 0)\r\n koArray.sort(sortFunction);\r\n\r\n " +
|
||||
" // Don\'t rotate if small & sorted correctly\r\n re" +
|
||||
"turn;\r\n }\r\n\r\n // Move Last Item to Top\r\n " +
|
||||
" var item = koArray.pop();\r\n koArray.unshift(item);\r\n " +
|
||||
" }\r\n function removeItemFromArray(koArray, deviceSerialNumber) {\r" +
|
||||
"\n var items = koArray();\r\n for (var i = 0; i < ite" +
|
||||
"ms.length; i++) {\r\n if (items[i].DeviceSerialNumber == device" +
|
||||
"SerialNumber) {\r\n koArray.splice(i, 1);\r\n " +
|
||||
" items = koArray();\r\n i--;\r\n }\r" +
|
||||
"\n }\r\n }\r\n function findUnsortedArrayTopInde" +
|
||||
"x(items) {\r\n // Only one Item\r\n if (items.length <" +
|
||||
"= 1)\r\n return 0;\r\n\r\n for (var i = 1; i < items" +
|
||||
".length; i++) {\r\n var s = sortFunction(items[i - 1], items[i]" +
|
||||
");\r\n if (s > 0)\r\n return i;\r\n " +
|
||||
" }\r\n\r\n return 0;\r\n }\r\n function findS" +
|
||||
"ortedInsertIndex(koArray, heldDeviceItem) {\r\n var items = koArray" +
|
||||
"();\r\n var startIndex = findUnsortedArrayTopIndex(items);\r\n " +
|
||||
" for (var i = startIndex; i < items.length; i++) {\r\n " +
|
||||
"var s = sortFunction(heldDeviceItem, items[i]);\r\n if (s <= 0)" +
|
||||
"\r\n return i;\r\n }\r\n if (star" +
|
||||
"tIndex !== 0) {\r\n for (var i = 0; i < startIndex; i++) {\r\n " +
|
||||
" var s = sortFunction(heldDeviceItem, items[i]);\r\n " +
|
||||
" if (s <= 0)\r\n return i;\r\n " +
|
||||
" }\r\n return startIndex;\r\n } else {\r\n " +
|
||||
" return -1;\r\n }\r\n }\r\n functio" +
|
||||
"n sortFunction(l, r) {\r\n return l.DeviceDescription.toLowerCase()" +
|
||||
" == r.DeviceDescription.toLowerCase() ? 0 : (l.DeviceDescription.toLowerCase() <" +
|
||||
" r.DeviceDescription.toLowerCase() ? -1 : 1)\r\n }\r\n functio" +
|
||||
"n isInProcess(i) {\r\n return !i.ReadyForReturn && !i.WaitingForUse" +
|
||||
"rAction;\r\n }\r\n function isReadyForReturn(i) {\r\n " +
|
||||
" return i.ReadyForReturn && !i.WaitingForUserAction;\r\n }\r\n " +
|
||||
" function isWaitingForUserAction(i) {\r\n return i.WaitingForUs" +
|
||||
"erAction;\r\n }\r\n function getQueryStringParameters() {\r\n\r\n " +
|
||||
" if (window.location.search.length === 0)\r\n ret" +
|
||||
"urn null;\r\n\r\n var params = {};\r\n window.location.s" +
|
||||
"earch.substr(1).split(\"&\").forEach(function (pair) {\r\n if (pa" +
|
||||
"ir === \"\") return;\r\n var parts = pair.split(\"=\");\r\n " +
|
||||
" params[parts[0]] = parts[1] && decodeURIComponent(parts[1].replace(/\\+" +
|
||||
"/g, \" \"));\r\n });\r\n return params;\r\n }\r\n" +
|
||||
"\r\n init();\r\n });\r\n </script>\r\n</body>\r\n</html>");
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -284,6 +284,17 @@
|
||||
|
||||
$.each(queryStringParameters, function (key, value) {
|
||||
switch (key.toLowerCase()) {
|
||||
case 'components':
|
||||
const showComponents = value.split(",");
|
||||
if (showComponents.length > 0) {
|
||||
const components = ['inProcess', 'readyForReturn', 'waitingForUserAction'];
|
||||
components.forEach(function (component) {
|
||||
if (!showComponents.includes(component)) {
|
||||
$('body').addClass('hide-' + component);
|
||||
}
|
||||
});
|
||||
}
|
||||
break;
|
||||
case 'theme': // THEME
|
||||
setTheme(value);
|
||||
fixedTheme = value;
|
||||
|
||||
@@ -344,100 +344,109 @@ WriteLiteral("\', null, function (data) {\r\n\r\n var inProce
|
||||
"= getQueryStringParameters();\r\n\r\n if (queryStringParameters !== n" +
|
||||
"ull) {\r\n var filters = [];\r\n\r\n $.each(quer" +
|
||||
"yStringParameters, function (key, value) {\r\n switch (key." +
|
||||
"toLowerCase()) {\r\n case \'theme\': // THEME\r\n " +
|
||||
" setTheme(value);\r\n fixedThe" +
|
||||
"me = value;\r\n break;\r\n " +
|
||||
" case \'deviceaddressinclude\': // FILTER: Device Address Include\r\n " +
|
||||
" var deviceAddresses = value.split(\",\").map(function (v) { retur" +
|
||||
"n v.toLowerCase(); });\r\n if (deviceAddresses.leng" +
|
||||
"th > 0) {\r\n filters.push(function (heldDevice" +
|
||||
"Item) {\r\n // false if DeviceAddressShortN" +
|
||||
"ame is null\r\n if (!heldDeviceItem.DeviceA" +
|
||||
"ddressShortName)\r\n return false;\r\n\r\n " +
|
||||
" // true if DeviceAddressShortName is incl" +
|
||||
"uded\r\n return $.inArray(heldDeviceItem.De" +
|
||||
"viceAddressShortName.toLowerCase(), deviceAddresses) >= 0;\r\n " +
|
||||
" });\r\n }\r\n " +
|
||||
" break;\r\n case \'deviceaddressexclude\': // FILT" +
|
||||
"ER: Device Address Exclude\r\n var deviceAddresses " +
|
||||
"= value.split(\",\").map(function (v) { return v.toLowerCase(); });\r\n " +
|
||||
" if (deviceAddresses.length > 0) {\r\n " +
|
||||
" filters.push(function (heldDeviceItem) {\r\n " +
|
||||
" // true if DeviceAddressShortName is null\r\n " +
|
||||
" if (!heldDeviceItem.DeviceAddressShortName)\r\n " +
|
||||
" return true;\r\n\r\n " +
|
||||
"// true if DeviceAddressShortName is excluded\r\n " +
|
||||
" return $.inArray(heldDeviceItem.DeviceAddressShortName.toLowerCase(), dev" +
|
||||
"iceAddresses) < 0;\r\n });\r\n " +
|
||||
" }\r\n break;\r\n " +
|
||||
" case \'deviceprofileinclude\': // FILTER: Device Profile Include\r\n " +
|
||||
" var deviceProfiles = value.split(\",\").map(function (v) { ret" +
|
||||
"urn parseInt(v); });\r\n if (deviceProfiles.length " +
|
||||
"> 0) {\r\n filters.push(function (heldDeviceIte" +
|
||||
"m) {\r\n // true if DeviceProfileId is incl" +
|
||||
"uded\r\n return $.inArray(heldDeviceItem.De" +
|
||||
"viceProfileId, deviceProfiles) >= 0;\r\n });\r\n " +
|
||||
" }\r\n break;\r\n " +
|
||||
" case \'deviceprofileexclude\': // FILTER: Device Profile Exc" +
|
||||
"lude\r\n var deviceProfiles = value.split(\",\").map(" +
|
||||
"function (v) { return parseInt(v); });\r\n if (devi" +
|
||||
"ceProfiles.length > 0) {\r\n filters.push(funct" +
|
||||
"ion (heldDeviceItem) {\r\n // true if Devic" +
|
||||
"eProfileId is excluded\r\n return $.inArray" +
|
||||
"(heldDeviceItem.DeviceProfileId, deviceProfiles) < 0;\r\n " +
|
||||
" });\r\n }\r\n " +
|
||||
" break;\r\n }\r\n });\r\n\r\n " +
|
||||
" if (filters.length > 0)\r\n itemFilters = filters;\r\n " +
|
||||
" else\r\n itemFilters = null;\r\n " +
|
||||
" }\r\n }\r\n\r\n function connectionError() {\r\n " +
|
||||
" try {\r\n $(\'body\').addClass(\'status-error\');\r\n " +
|
||||
" $.connection.hub.stop();\r\n } catch (e) {\r\n " +
|
||||
" // Ignore\r\n }\r\n\r\n window.setTimeout(function (" +
|
||||
") {\r\n window.location.reload(true);\r\n }, 10000" +
|
||||
");\r\n }\r\n\r\n // Helpers\r\n function rotateArray(ko" +
|
||||
"Array, element) {\r\n var items = koArray();\r\n\r\n if " +
|
||||
"(items.length <= 1)\r\n return 0;\r\n\r\n if (elemen" +
|
||||
"t.height() < (element.parent().height() - 30)) {\r\n\r\n if (find" +
|
||||
"UnsortedArrayTopIndex(items) !== 0)\r\n koArray.sort(sortFu" +
|
||||
"nction);\r\n\r\n // Don\'t rotate if small & sorted correctly\r\n " +
|
||||
" return;\r\n }\r\n\r\n // Move Last Item" +
|
||||
" to Top\r\n var item = koArray.pop();\r\n koArray.unsh" +
|
||||
"ift(item);\r\n }\r\n function removeItemFromArray(koArray, Use" +
|
||||
"rId) {\r\n var items = koArray();\r\n for (var i = 0; " +
|
||||
"i < items.length; i++) {\r\n if (items[i].UserId == UserId) {\r\n" +
|
||||
" koArray.splice(i, 1);\r\n items = k" +
|
||||
"oArray();\r\n i--;\r\n }\r\n " +
|
||||
"}\r\n }\r\n function findUnsortedArrayTopIndex(items) {\r\n " +
|
||||
" // Only one Item\r\n if (items.length <= 1)\r\n " +
|
||||
" return 0;\r\n\r\n for (var i = 1; i < items.length; i++) {\r\n" +
|
||||
" var s = sortFunction(items[i - 1], items[i]);\r\n " +
|
||||
" if (s > 0)\r\n return i;\r\n }\r\n\r\n " +
|
||||
" return 0;\r\n }\r\n function findSortedInsertIndex(" +
|
||||
"koArray, heldDeviceItem) {\r\n var items = koArray();\r\n " +
|
||||
" var startIndex = findUnsortedArrayTopIndex(items);\r\n for (var" +
|
||||
" i = startIndex; i < items.length; i++) {\r\n var s = sortFunct" +
|
||||
"ion(heldDeviceItem, items[i]);\r\n if (s <= 0)\r\n " +
|
||||
" return i;\r\n }\r\n if (startIndex !== 0) {\r\n" +
|
||||
" for (var i = 0; i < startIndex; i++) {\r\n " +
|
||||
" var s = sortFunction(heldDeviceItem, items[i]);\r\n if " +
|
||||
"(s <= 0)\r\n return i;\r\n }\r\n " +
|
||||
" return startIndex;\r\n } else {\r\n re" +
|
||||
"turn -1;\r\n }\r\n }\r\n function sortFunction(l," +
|
||||
" r) {\r\n return l.UserIdFriendly.toLowerCase() == r.UserIdFriendly" +
|
||||
".toLowerCase() ? 0 : (l.UserIdFriendly.toLowerCase() < r.UserIdFriendly.toLowerC" +
|
||||
"ase() ? -1 : 1)\r\n }\r\n function isInProcess(i) {\r\n " +
|
||||
" return !i.ReadyForReturn && !i.WaitingForUserAction;\r\n }\r\n " +
|
||||
" function isReadyForReturn(i) {\r\n return i.ReadyForReturn " +
|
||||
"&& !i.WaitingForUserAction;\r\n }\r\n function isWaitingForUse" +
|
||||
"rAction(i) {\r\n return i.WaitingForUserAction;\r\n }\r\n " +
|
||||
" function getQueryStringParameters() {\r\n\r\n if (window.loc" +
|
||||
"ation.search.length === 0)\r\n return null;\r\n\r\n " +
|
||||
"var params = {};\r\n window.location.search.substr(1).split(\"&\").fo" +
|
||||
"rEach(function (pair) {\r\n if (pair === \"\") return;\r\n " +
|
||||
" var parts = pair.split(\"=\");\r\n params[parts[0]] = " +
|
||||
"parts[1] && decodeURIComponent(parts[1].replace(/\\+/g, \" \"));\r\n }" +
|
||||
");\r\n return params;\r\n }\r\n\r\n init();\r\n " +
|
||||
" });\r\n </script>\r\n</body>\r\n</html>\r\n");
|
||||
"toLowerCase()) {\r\n case \'components\':\r\n " +
|
||||
" const showComponents = value.split(\",\");\r\n " +
|
||||
" if (showComponents.length > 0) {\r\n " +
|
||||
" const components = [\'inProcess\', \'readyForReturn\', \'waitingForUserAction\'];\r\n " +
|
||||
" components.forEach(function (component) {\r\n " +
|
||||
" if (!showComponents.includes(component)) {" +
|
||||
"\r\n $(\'body\').addClass(\'hide-\' + compo" +
|
||||
"nent);\r\n }\r\n " +
|
||||
" });\r\n }\r\n b" +
|
||||
"reak;\r\n case \'theme\': // THEME\r\n " +
|
||||
" setTheme(value);\r\n fixedTheme = value;" +
|
||||
"\r\n break;\r\n case \'devi" +
|
||||
"ceaddressinclude\': // FILTER: Device Address Include\r\n " +
|
||||
" var deviceAddresses = value.split(\",\").map(function (v) { return v.toLower" +
|
||||
"Case(); });\r\n if (deviceAddresses.length > 0) {\r\n" +
|
||||
" filters.push(function (heldDeviceItem) {\r\n " +
|
||||
" // false if DeviceAddressShortName is null" +
|
||||
"\r\n if (!heldDeviceItem.DeviceAddressShort" +
|
||||
"Name)\r\n return false;\r\n\r\n " +
|
||||
" // true if DeviceAddressShortName is included\r\n " +
|
||||
" return $.inArray(heldDeviceItem.DeviceAddress" +
|
||||
"ShortName.toLowerCase(), deviceAddresses) >= 0;\r\n " +
|
||||
" });\r\n }\r\n bre" +
|
||||
"ak;\r\n case \'deviceaddressexclude\': // FILTER: Device " +
|
||||
"Address Exclude\r\n var deviceAddresses = value.spl" +
|
||||
"it(\",\").map(function (v) { return v.toLowerCase(); });\r\n " +
|
||||
" if (deviceAddresses.length > 0) {\r\n f" +
|
||||
"ilters.push(function (heldDeviceItem) {\r\n " +
|
||||
" // true if DeviceAddressShortName is null\r\n " +
|
||||
" if (!heldDeviceItem.DeviceAddressShortName)\r\n " +
|
||||
" return true;\r\n\r\n // true if " +
|
||||
"DeviceAddressShortName is excluded\r\n retu" +
|
||||
"rn $.inArray(heldDeviceItem.DeviceAddressShortName.toLowerCase(), deviceAddresse" +
|
||||
"s) < 0;\r\n });\r\n " +
|
||||
" }\r\n break;\r\n case \'d" +
|
||||
"eviceprofileinclude\': // FILTER: Device Profile Include\r\n " +
|
||||
" var deviceProfiles = value.split(\",\").map(function (v) { return parseIn" +
|
||||
"t(v); });\r\n if (deviceProfiles.length > 0) {\r\n " +
|
||||
" filters.push(function (heldDeviceItem) {\r\n " +
|
||||
" // true if DeviceProfileId is included\r\n " +
|
||||
" return $.inArray(heldDeviceItem.DeviceProfile" +
|
||||
"Id, deviceProfiles) >= 0;\r\n });\r\n " +
|
||||
" }\r\n break;\r\n " +
|
||||
" case \'deviceprofileexclude\': // FILTER: Device Profile Exclude\r\n " +
|
||||
" var deviceProfiles = value.split(\",\").map(function (v" +
|
||||
") { return parseInt(v); });\r\n if (deviceProfiles." +
|
||||
"length > 0) {\r\n filters.push(function (heldDe" +
|
||||
"viceItem) {\r\n // true if DeviceProfileId " +
|
||||
"is excluded\r\n return $.inArray(heldDevice" +
|
||||
"Item.DeviceProfileId, deviceProfiles) < 0;\r\n " +
|
||||
"});\r\n }\r\n break;\r\n" +
|
||||
" }\r\n });\r\n\r\n if (fi" +
|
||||
"lters.length > 0)\r\n itemFilters = filters;\r\n " +
|
||||
" else\r\n itemFilters = null;\r\n }\r\n " +
|
||||
" }\r\n\r\n function connectionError() {\r\n try {\r\n " +
|
||||
" $(\'body\').addClass(\'status-error\');\r\n $.co" +
|
||||
"nnection.hub.stop();\r\n } catch (e) {\r\n // Igno" +
|
||||
"re\r\n }\r\n\r\n window.setTimeout(function () {\r\n " +
|
||||
" window.location.reload(true);\r\n }, 10000);\r\n " +
|
||||
" }\r\n\r\n // Helpers\r\n function rotateArray(koArray, elem" +
|
||||
"ent) {\r\n var items = koArray();\r\n\r\n if (items.leng" +
|
||||
"th <= 1)\r\n return 0;\r\n\r\n if (element.height() " +
|
||||
"< (element.parent().height() - 30)) {\r\n\r\n if (findUnsortedArr" +
|
||||
"ayTopIndex(items) !== 0)\r\n koArray.sort(sortFunction);\r\n\r" +
|
||||
"\n // Don\'t rotate if small & sorted correctly\r\n " +
|
||||
" return;\r\n }\r\n\r\n // Move Last Item to Top\r\n " +
|
||||
" var item = koArray.pop();\r\n koArray.unshift(item);\r" +
|
||||
"\n }\r\n function removeItemFromArray(koArray, UserId) {\r\n " +
|
||||
" var items = koArray();\r\n for (var i = 0; i < items.l" +
|
||||
"ength; i++) {\r\n if (items[i].UserId == UserId) {\r\n " +
|
||||
" koArray.splice(i, 1);\r\n items = koArray();\r\n" +
|
||||
" i--;\r\n }\r\n }\r\n " +
|
||||
" }\r\n function findUnsortedArrayTopIndex(items) {\r\n " +
|
||||
"// Only one Item\r\n if (items.length <= 1)\r\n re" +
|
||||
"turn 0;\r\n\r\n for (var i = 1; i < items.length; i++) {\r\n " +
|
||||
" var s = sortFunction(items[i - 1], items[i]);\r\n if (" +
|
||||
"s > 0)\r\n return i;\r\n }\r\n\r\n " +
|
||||
"return 0;\r\n }\r\n function findSortedInsertIndex(koArray, he" +
|
||||
"ldDeviceItem) {\r\n var items = koArray();\r\n var sta" +
|
||||
"rtIndex = findUnsortedArrayTopIndex(items);\r\n for (var i = startI" +
|
||||
"ndex; i < items.length; i++) {\r\n var s = sortFunction(heldDev" +
|
||||
"iceItem, items[i]);\r\n if (s <= 0)\r\n re" +
|
||||
"turn i;\r\n }\r\n if (startIndex !== 0) {\r\n " +
|
||||
" for (var i = 0; i < startIndex; i++) {\r\n var s =" +
|
||||
" sortFunction(heldDeviceItem, items[i]);\r\n if (s <= 0)\r\n " +
|
||||
" return i;\r\n }\r\n " +
|
||||
" return startIndex;\r\n } else {\r\n return -1;\r\n " +
|
||||
" }\r\n }\r\n function sortFunction(l, r) {\r\n " +
|
||||
" return l.UserIdFriendly.toLowerCase() == r.UserIdFriendly.toLowerCas" +
|
||||
"e() ? 0 : (l.UserIdFriendly.toLowerCase() < r.UserIdFriendly.toLowerCase() ? -1 " +
|
||||
": 1)\r\n }\r\n function isInProcess(i) {\r\n retu" +
|
||||
"rn !i.ReadyForReturn && !i.WaitingForUserAction;\r\n }\r\n fun" +
|
||||
"ction isReadyForReturn(i) {\r\n return i.ReadyForReturn && !i.Waiti" +
|
||||
"ngForUserAction;\r\n }\r\n function isWaitingForUserAction(i) " +
|
||||
"{\r\n return i.WaitingForUserAction;\r\n }\r\n fu" +
|
||||
"nction getQueryStringParameters() {\r\n\r\n if (window.location.searc" +
|
||||
"h.length === 0)\r\n return null;\r\n\r\n var params " +
|
||||
"= {};\r\n window.location.search.substr(1).split(\"&\").forEach(funct" +
|
||||
"ion (pair) {\r\n if (pair === \"\") return;\r\n " +
|
||||
"var parts = pair.split(\"=\");\r\n params[parts[0]] = parts[1] &&" +
|
||||
" decodeURIComponent(parts[1].replace(/\\+/g, \" \"));\r\n });\r\n " +
|
||||
" return params;\r\n }\r\n\r\n init();\r\n });\r\n " +
|
||||
"</script>\r\n</body>\r\n</html>\r\n");
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user