This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function populateList (listJoin, elements) { | |
| CF.log("Populating list"); | |
| // Clear the list | |
| CF.listRemove(listJoin); | |
| // Create an array to fill with list contents | |
| var newContents = []; | |
| // Avoid using Array.forEach() method as it uses callbacks to access the data, which means code after the forEach loop will be executed before the loop finishes. | |
| for (var i=0; i<elements.length; i++) { | |
| newContents.push({s1: element.textlabel, s2: element.filename}); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* Basic Command Queuing for CommandFusion | |
| USAGE: | |
| - First step: Replace the "SYSTEM NAME GOES HERE" text towards the end of the script with your actual system name as defined in the System Manager of your GUI project | |
| - Next: Save this script into a .js file and add it to your GUI project via Project Properties > Script Manager. | |
| - Ensure you are using iViewer4 (NOT CF iViewer, legacy product without JavaScript support) | |
| - within button properties, add a JavaScript call such as: | |
| CommandQueue.startCommand("StartDataGoesHere"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //Image Array | |
| var Images = new Array(); | |
| Images[0] = "image00.png"; | |
| Images[1] = "image01.png"; | |
| Images[2] = "image03.png"; | |
| Images[3] = "image02.png"; | |
| function ImageChange(join, value) { | |
| var nJoin = join.substr(1); // strip the "a" from the join string to just get the join number. | |
| CF.setJoin("s" + nJoin, Images[value]); // set the serial value with an image. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var manageItems = ["l1","l2","l3","l4"]; | |
| function showItem(joinToShow) { | |
| var hideItems = []; | |
| for (var i = 0; i < manageItems.length; i++) { | |
| if (manageItems[i] != joinToShow) { | |
| hideItems.push({join: manageItems[i], opacity: 0}); | |
| } | |
| } | |
| hideItems.push({join: joinToShow, opacity: 1}); | |
| CF.setProperties(hideItems); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| NOTE: Change "System Name" and "Feedback Name" to the correct info for your project first. | |
| NOTE: Change "d1" to the digital join number of your power button. | |
| NOTE: on your power button, set the javascript to: togglePower(); | |
| */ | |
| var powerState = 0; | |
| var powerStateRegex = /\x21\x01\x00\x00\x01(\x00|\x01)\x0D/; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * rfc3986 compatable encode of a string | |
| * | |
| * @param {String} string | |
| */ | |
| self.urlEncode = function (string) { | |
| function hex(code) { | |
| var hex = code.toString(16).toUpperCase(); | |
| if (hex.length < 2) { | |
| hex = 0 + hex; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var baseURL = "www.someurl.com"; | |
| var theURL = "/some/url?param=test"; | |
| var headerString = "\ | |
| PUT "+theURL+" HTTP/1.1\r\n\ | |
| Host: "+baseURL+"\r\n\ | |
| Accept-Encoding: gzip, deflate\r\n\ | |
| Content-Type: text/xml\r\n\ | |
| Content-Length: "; |
NewerOlder