index.js |
Top Previous Next |
The complete code for index.js used in Adding embedded Screen Rules is:
function log(msg) { var logPane = document.getElementById('log'); logPane.innerHTML += msg + "<br/>"; logPane.scrollTop = logPane.scrollHeight; } function clearlog() { document.getElementById('log').innerHTML = ''; } var hs = new zScope.HostSurfer({ term: { url: "http://zanywhere.cybelesoft.com/hsdemo/", float: { top: 5, right: 5, width: 600, height: 400 } }, rules: { baseUrl: 'rules/', paths: ['cics', 'bluecardLogin'] }, view: { id: "hs-view" } }); hs.on('ready', function () { log('Ready!'); }); hs.on('pageLocked', function () { log('Page locked.'); }); hs.on('pageUnlocked', function () { log('Page unlocked.'); }); hs.on('ruleSelected', function (value) { if (document.getElementById("showFields").checked) { for (field in hs.data) { if (hs.data[field] != "") { if (typeof hs.data[field] == "object") { log(field + ": " + JSON.stringify(hs.data[field])); } else { log(field + ": '" + hs.data[field] + "'"); } } } } if (value) { log('Rule selected: ' + value.id); } else { log('No matching rule'); } });
|