//---------------- json2.js----------------
/*
http://www.JSON.org/json2.js
2010-11-17
Public Domain.
NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK.
See http://www.JSON.org/js.html
This code should be minified before deployment.
See http://javascript.crockford.com/jsmin.html
USE YOUR OWN COPY. IT IS EXTREMELY UNWISE TO LOAD CODE FROM SERVERS YOU DO
NOT CONTROL.
This file creates a global JSON object containing two methods: stringify
and parse.
JSON.stringify(value, replacer, space)
value any JavaScript value, usually an object or array.
replacer an optional parameter that determines how object
values are stringified for objects. It can be a
function or an array of strings.
space an optional parameter that specifies the indentation
of nested structures. If it is omitted, the text will
be packed without extra whitespace. If it is a number,
it will specify the number of spaces to indent at each
level. If it is a string (such as '\t' or ' '),
it contains the characters used to indent at each level.
This method produces a JSON text from a JavaScript value.
When an object value is found, if the object contains a toJSON
method, its toJSON method will be called and the result will be
stringified. A toJSON method does not serialize: it returns the
value represented by the name/value pair that should be serialized,
or undefined if nothing should be serialized. The toJSON method
will be passed the key associated with the value, and this will be
bound to the value
For example, this would serialize Dates as ISO strings.
Date.prototype.toJSON = function (key) {
function f(n) {
// Format integers to have at least two digits.
return n < 10 ? '0' + n : n;
}
return this.getUTCFullYear() + '-' +
f(this.getUTCMonth() + 1) + '-' +
f(this.getUTCDate()) + 'T' +
f(this.getUTCHours()) + ':' +
f(this.getUTCMinutes()) + ':' +
f(this.getUTCSeconds()) + 'Z';
};
You can provide an optional replacer method. It will be passed the
key and value of each member, with this bound to the containing
object. The value that is returned from your method will be
serialized. If your method returns undefined, then the member will
be excluded from the serialization.
If the replacer parameter is an array of strings, then it will be
used to select the members to be serialized. It filters the results
such that only members with keys listed in the replacer array are
stringified.
Values that do not have JSON representations, such as undefined or
functions, will not be serialized. Such values in objects will be
dropped; in arrays they will be replaced with null. You can use
a replacer function to replace those with JSON values.
JSON.stringify(undefined) returns undefined.
The optional space parameter produces a stringification of the
value that is filled with line breaks and indentation to make it
easier to read.
If the space parameter is a non-empty string, then that string will
be used for indentation. If the space parameter is a number, then
the indentation will be that many spaces.
Example:
text = JSON.stringify(['e', {pluribus: 'unum'}]);
// text is '["e",{"pluribus":"unum"}]'
text = JSON.stringify(['e', {pluribus: 'unum'}], null, '\t');
// text is '[\n\t"e",\n\t{\n\t\t"pluribus": "unum"\n\t}\n]'
text = JSON.stringify([new Date()], function (key, value) {
return this[key] instanceof Date ?
'Date(' + this[key] + ')' : value;
});
// text is '["Date(---current time---)"]'
JSON.parse(text, reviver)
This method parses a JSON text to produce an object or array.
It can throw a SyntaxError exception.
The optional reviver parameter is a function that can filter and
transform the results. It receives each of the keys and values,
and its return value is used instead of the original value.
If it returns what it received, then the structure is not modified.
If it returns undefined then the member is deleted.
Example:
// Parse the text. Values that look like ISO date strings will
// be converted to Date objects.
myData = JSON.parse(text, function (key, value) {
var a;
if (typeof value === 'string') {
a =
/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2}(?:\.\d*)?)Z$/.exec(value);
if (a) {
return new Date(Date.UTC(+a[1], +a[2] - 1, +a[3], +a[4],
+a[5], +a[6]));
}
}
return value;
});
myData = JSON.parse('["Date(09/09/2001)"]', function (key, value) {
var d;
if (typeof value === 'string' &&
value.slice(0, 5) === 'Date(' &&
value.slice(-1) === ')') {
d = new Date(value.slice(5, -1));
if (d) {
return d;
}
}
return value;
});
This is a reference implementation. You are free to copy, modify, or
redistribute.
*/
/*jslint evil: true, strict: false, regexp: false */
/*members "", "\b", "\t", "\n", "\f", "\r", "\"", JSON, "\\", apply,
call, charCodeAt, getUTCDate, getUTCFullYear, getUTCHours,
getUTCMinutes, getUTCMonth, getUTCSeconds, hasOwnProperty, join,
lastIndex, length, parse, prototype, push, replace, slice, stringify,
test, toJSON, toString, valueOf
*/
// Create a JSON object only if one does not already exist. We create the
// methods in a closure to avoid creating global variables.
if (!this.JSON) {
this.JSON = {};
}
(function () {
"use strict";
function f(n) {
// Format integers to have at least two digits.
return n < 10 ? '0' + n : n;
}
if (typeof Date.prototype.toJSON !== 'function') {
Date.prototype.toJSON = function (key) {
return isFinite(this.valueOf()) ?
this.getUTCFullYear() + '-' +
f(this.getUTCMonth() + 1) + '-' +
f(this.getUTCDate()) + 'T' +
f(this.getUTCHours()) + ':' +
f(this.getUTCMinutes()) + ':' +
f(this.getUTCSeconds()) + 'Z' : null;
};
String.prototype.toJSON =
Number.prototype.toJSON =
Boolean.prototype.toJSON = function (key) {
return this.valueOf();
};
}
var cx = /[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,
escapable = /[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,
gap,
indent,
meta = { // table of character substitutions
'\b': '\\b',
'\t': '\\t',
'\n': '\\n',
'\f': '\\f',
'\r': '\\r',
'"' : '\\"',
'\\': '\\\\'
},
rep;
function quote(string) {
// If the string contains no control characters, no quote characters, and no
// backslash characters, then we can safely slap some quotes around it.
// Otherwise we must also replace the offending characters with safe escape
// sequences.
escapable.lastIndex = 0;
return escapable.test(string) ?
'"' + string.replace(escapable, function (a) {
var c = meta[a];
return typeof c === 'string' ? c :
'\\u' + ('0000' + a.charCodeAt(0).toString(16)).slice(-4);
}) + '"' :
'"' + string + '"';
}
function str(key, holder) {
// Produce a string from holder[key].
var i, // The loop counter.
k, // The member key.
v, // The member value.
length,
mind = gap,
partial,
value = holder[key];
// If the value has a toJSON method, call it to obtain a replacement value.
if (value && typeof value === 'object' &&
typeof value.toJSON === 'function') {
value = value.toJSON(key);
}
// If we were called with a replacer function, then call the replacer to
// obtain a replacement value.
if (typeof rep === 'function') {
value = rep.call(holder, key, value);
}
// What happens next depends on the value's type.
switch (typeof value) {
case 'string':
return quote(value);
case 'number':
// JSON numbers must be finite. Encode non-finite numbers as null.
return isFinite(value) ? String(value) : 'null';
case 'boolean':
case 'null':
// If the value is a boolean or null, convert it to a string. Note:
// typeof null does not produce 'null'. The case is included here in
// the remote chance that this gets fixed someday.
return String(value);
// If the type is 'object', we might be dealing with an object or an array or
// null.
case 'object':
// Due to a specification blunder in ECMAScript, typeof null is 'object',
// so watch out for that case.
if (!value) {
return 'null';
}
// Make an array to hold the partial results of stringifying this object value.
gap += indent;
partial = [];
// Is the value an array?
if (Object.prototype.toString.apply(value) === '[object Array]') {
// The value is an array. Stringify every element. Use null as a placeholder
// for non-JSON values.
length = value.length;
for (i = 0; i < length; i += 1) {
partial[i] = str(i, value) || 'null';
}
// Join all of the elements together, separated with commas, and wrap them in
// brackets.
v = partial.length === 0 ? '[]' :
gap ? '[\n' + gap +
partial.join(',\n' + gap) + '\n' +
mind + ']' :
'[' + partial.join(',') + ']';
gap = mind;
return v;
}
// If the replacer is an array, use it to select the members to be stringified.
if (rep && typeof rep === 'object') {
length = rep.length;
for (i = 0; i < length; i += 1) {
k = rep[i];
if (typeof k === 'string') {
v = str(k, value);
if (v) {
partial.push(quote(k) + (gap ? ': ' : ':') + v);
}
}
}
} else {
// Otherwise, iterate through all of the keys in the object.
for (k in value) {
if (Object.hasOwnProperty.call(value, k)) {
v = str(k, value);
if (v) {
partial.push(quote(k) + (gap ? ': ' : ':') + v);
}
}
}
}
// Join all of the member texts together, separated with commas,
// and wrap them in braces.
v = partial.length === 0 ? '{}' :
gap ? '{\n' + gap + partial.join(',\n' + gap) + '\n' +
mind + '}' : '{' + partial.join(',') + '}';
gap = mind;
return v;
}
}
// If the JSON object does not yet have a stringify method, give it one.
if (typeof JSON.stringify !== 'function') {
JSON.stringify = function (value, replacer, space) {
// The stringify method takes a value and an optional replacer, and an optional
// space parameter, and returns a JSON text. The replacer can be a function
// that can replace values, or an array of strings that will select the keys.
// A default replacer method can be provided. Use of the space parameter can
// produce text that is more easily readable.
var i;
gap = '';
indent = '';
// If the space parameter is a number, make an indent string containing that
// many spaces.
if (typeof space === 'number') {
for (i = 0; i < space; i += 1) {
indent += ' ';
}
// If the space parameter is a string, it will be used as the indent string.
} else if (typeof space === 'string') {
indent = space;
}
// If there is a replacer, it must be a function or an array.
// Otherwise, throw an error.
rep = replacer;
if (replacer && typeof replacer !== 'function' &&
(typeof replacer !== 'object' ||
typeof replacer.length !== 'number')) {
throw new Error('JSON.stringify');
}
// Make a fake root object containing our value under the key of ''.
// Return the result of stringifying the value.
return str('', {'': value});
};
}
// If the JSON object does not yet have a parse method, give it one.
if (typeof JSON.parse !== 'function') {
JSON.parse = function (text, reviver) {
// The parse method takes a text and an optional reviver function, and returns
// a JavaScript value if the text is a valid JSON text.
var j;
function walk(holder, key) {
// The walk method is used to recursively walk the resulting structure so
// that modifications can be made.
var k, v, value = holder[key];
if (value && typeof value === 'object') {
for (k in value) {
if (Object.hasOwnProperty.call(value, k)) {
v = walk(value, k);
if (v !== undefined) {
value[k] = v;
} else {
delete value[k];
}
}
}
}
return reviver.call(holder, key, value);
}
// Parsing happens in four stages. In the first stage, we replace certain
// Unicode characters with escape sequences. JavaScript handles many characters
// incorrectly, either silently deleting them, or treating them as line endings.
text = String(text);
cx.lastIndex = 0;
if (cx.test(text)) {
text = text.replace(cx, function (a) {
return '\\u' +
('0000' + a.charCodeAt(0).toString(16)).slice(-4);
});
}
// In the second stage, we run the text against regular expressions that look
// for non-JSON patterns. We are especially concerned with '()' and 'new'
// because they can cause invocation, and '=' because it can cause mutation.
// But just to be safe, we want to reject all unexpected forms.
// We split the second stage into 4 regexp operations in order to work around
// crippling inefficiencies in IE's and Safari's regexp engines. First we
// replace the JSON backslash pairs with '@' (a non-JSON character). Second, we
// replace all simple value tokens with ']' characters. Third, we delete all
// open brackets that follow a colon or comma or that begin the text. Finally,
// we look to see that the remaining characters are only whitespace or ']' or
// ',' or ':' or '{' or '}'. If that is so, then the text is safe for eval.
if (/^[\],:{}\s]*$/
.test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, '@')
.replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, ']')
.replace(/(?:^|:|,)(?:\s*\[)+/g, ''))) {
// In the third stage we use the eval function to compile the text into a
// JavaScript structure. The '{' operator is subject to a syntactic ambiguity
// in JavaScript: it can begin a block or an object literal. We wrap the text
// in parens to eliminate the ambiguity.
j = eval('(' + text + ')');
// In the optional fourth stage, we recursively walk the new structure, passing
// each name/value pair to a reviver function for possible transformation.
return typeof reviver === 'function' ?
walk({'': j}, '') : j;
}
// If the text is not JSON parseable, then a SyntaxError is thrown.
throw new SyntaxError('JSON.parse');
};
}
}());
//---------------- till here --------------
function checkifijisdisplayed(){
if(document.getElementById("ijfooter") != null && document.getElementById("ijfooter") ==''){
var e1 = document.getElementById('startij');
if(e1 != null){
e1.style.display = 'block';
}
}
}
//IJ main page
var ijpagename = 'ij.html';
//alert(document.location.href);
//get is called from callij.com
if(document.location.href.indexOf("call") != -1){
ijpagename = 'indexIJ.php';
}
//id of last checkbox for delete
var latestcheckboxidForDelete = '';
//id of last checkbox for copy
var latestcheckboxidForCopy = '';
//if for last checkbox for move
var latestcheckboxidForMove = '';
//request counter
var requestid = Math.floor((Math.random()*100000)+1); ;
//Browser Support Code
//flag to indicate if ij is ready
var status = "";
//flag to mark if response was received from backend
var responseReceived = 0;
//silo for this page, knw is default silo
var silo = "ij";
//logged in user
var user = "";
//id
var id = "";
//confirmationid if present in url
var confirmationid = "";
//whenever check box is clicked, focus shoud go back to user input
function focusUserInput(){
document.getElementById("userinput").focus();
}
//function to get ajaxRequest
function getAjaxRequestObject(){
try{
// Opera 8.0+, Firefox, Safari
ajaxRequest = new XMLHttpRequest();
} catch (e){
// Internet Explorer Browsers
try{
ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try{
ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
} catch (e){
// Something went wrong
alert("Your browser broke!");
return false;
}
}
}
return ajaxRequest;
}
//funtion to automate any automatic processing required
function processurlinitialization(defaultmessage){
//if confirmation id is not null, then process confirmation id
if(!empty(confirmationid)){
//if confirmationid is 'demo' login with demo user
if(confirmationid == 'demo'){
//do nothing
}
else{
//set user id
id = defaultmessage.id;
configureUser();
}
}
else{
//display original message to user
setResponse(defaultmessage);
}
//moveCaretToEnd(document.getElementById('ij'));
//location.href="#ijtop";
//bring curson to the end in ij text area
//moveCaretToEnd(document.getElementById('ij'));
location.href="#bottomhref";
//for chrome
var objDiv = document.getElementById("ijparent");
objDiv.scrollTop = objDiv.scrollHeight;
//hide select box
document.getElementById('hintcategory').style.display = 'none';
//document.onkeypress = processKey;
document.onkeydown = processKey;
//scroll to bottom
location.href="#bottomhref";
document.getElementById("userinput").focus();
}
//funtion to automate any automatic processing required for demo
function processurlinitializationForDemo(defaultmessage){
var respData = defaultmessage;
//currCommand
currCommand = respData.command;
//current question type
currentQuestionType = respData.questiontype;
if(currCommand == 'delete' && currentQuestionType != 'confirmdelete'){
latestcheckboxidForDelete = respData.requestid;
}
else if(currCommand == 'copy' && currentQuestionType != 'confirmcopy'){
latestcheckboxidForCopy = respData.requestid;
}
else if(currCommand == 'move' && currentQuestionType != 'confirmmove'){
latestcheckboxidForMove = respData.requestid;
}
//set user id
id = respData.id;
//set user
user = respData.user;
//set status
status = respData.status;
questionType = respData.questiontype;
if(questionType == 'password'){
document.onkeyup = encodeKey;
}
else{
document.onkeyup = donothing;
}
//moveCaretToEnd(document.getElementById('ij'));
//location.href="#ijtop";
//bring curson to the end in ij text area
//moveCaretToEnd(document.getElementById('ij'));
location.href="#bottomhref";
//for chrome
var objDiv = document.getElementById("ijparent");
objDiv.scrollTop = objDiv.scrollHeight;
//hide select box
document.getElementById('hintcategory').style.display = 'none';
//document.onkeypress = processKey;
document.onkeydown = processKey;
//scroll to bottom
location.href="#bottomhref";
document.getElementById("userinput").focus();
}
//function to login with meddemo account
function loginWithMedDemo(){
//get google analytic seperately for med
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-53015770-1', 'auto');
ga('send', 'pageview');
// till here
//get user confirmation
var r = confirm("Do not take medicine(s) without consulting your doctor. www.callij.com will not be responsible for any adverse condition(s) or any undesirable effects caused by drugs/medicines mentioned. \n\n Press 'OK' if you Agree. ");
if (r == true) {
//do nothing
} else {
//user don't agree so don't login
return;
}
//set confirmation to demo
confirmationid = 'demo';
var e1 = document.getElementById('startij');
e1.style.display = 'block';
//remove background image
document.body.style.backgroundImage = "none";
//document.body.style.background = '';
hidelandingpage();
//hide backup
bakup1 = document.getElementById('Backup');
bakup1.style.display = 'none';
//if url contains confirmation id, then automatically process confirmation id
confirmationid = getUrlVars()["confirmationid"];
//init output
initJini();
var ajaxRequest; // The variable that makes Ajax possible!
try{
// Opera 8.0+, Firefox, Safari
ajaxRequest = new XMLHttpRequest();
} catch (e){
// Internet Explorer Browsers
try{
ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try{
ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
} catch (e){
// Something went wrong
alert("Your browser broke!");
return false;
}
}
}
var operation = 'ij';
//var to identify if this is a searchrequest
var searchidentifier = '1s2e3a4r5c6h7s8e9a0r1c2h3';
var userinputFirst = "";
var paramsJSON = {
"identifier" : searchidentifier,
"operation" : operation,
"user" : user,
"id" : id,
"userinput" : userinputFirst,
"silo" : silo
}
ajaxRequest.open("POST", ijpagename, false);
ajaxRequest.send(JSON.stringify(paramsJSON));
//process any automatic processing to be done
//based on current url
processurlinitializationForDemo(JSON.parse(ajaxRequest.responseText));
ajaxRequest = getAjaxRequestObject();
var operation = 'ij';
//var to identify if this is a searchrequest
var searchidentifier = '1s2e3a4r5c6h7s8e9a0r1c2h3';
var userinputFirst = "meddemo";
var paramsJSON = {
"identifier" : searchidentifier,
"operation" : operation,
"id" : id,
"userinput" : userinputFirst,
"silo" : silo
}
ajaxRequest.open("POST", ijpagename, false);
ajaxRequest.send(JSON.stringify(paramsJSON));
//setResponse(JSON.parse(ajaxRequest.responseText));
ajaxRequest = getAjaxRequestObject();
userinputFirst = 'test';
var paramsJSON = {
"identifier" : searchidentifier,
"operation" : operation,
"user" : user,
"id" : id,
"userinput" : userinputFirst,
"silo" : silo
}
ajaxRequest.open("POST", ijpagename, false);
ajaxRequest.send(JSON.stringify(paramsJSON));
setResponse(JSON.parse(ajaxRequest.responseText));
//reset confirmationid
confirmationid = '';
//stop timer
responseReceived = 1;
//scroll to bottom
location.href="#bottomhref";
document.getElementById("userinput").focus();
}
function hidelandingpage(){
//remove welcome message
var ijfooterelem = document.getElementById("welcomediv");
ijfooterelem.innerHTML='';
}
//function to login with demo account
function loginWithDemo(){
//set confirmation to demo
confirmationid = 'demo';
var e1 = document.getElementById('startij');
e1.style.display = 'block';
//remove background image
document.body.style.backgroundImage = "none";
//document.body.style.background = '';
hidelandingpage();
//if url contains confirmation id, then automatically process confirmation id
confirmationid = getUrlVars()["confirmationid"];
//init output
initJini();
var ajaxRequest; // The variable that makes Ajax possible!
try{
// Opera 8.0+, Firefox, Safari
ajaxRequest = new XMLHttpRequest();
} catch (e){
// Internet Explorer Browsers
try{
ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try{
ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
} catch (e){
// Something went wrong
alert("Your browser broke!");
return false;
}
}
}
var operation = 'ij';
//var to identify if this is a searchrequest
var searchidentifier = '1s2e3a4r5c6h7s8e9a0r1c2h3';
var userinputFirst = "";
var paramsJSON = {
"identifier" : searchidentifier,
"operation" : operation,
"user" : user,
"id" : id,
"userinput" : userinputFirst,
"silo" : silo
}
ajaxRequest.open("POST", ijpagename, false);
ajaxRequest.send(JSON.stringify(paramsJSON));
//process any automatic processing to be done
//based on current url
processurlinitializationForDemo(JSON.parse(ajaxRequest.responseText));
ajaxRequest = getAjaxRequestObject();
var operation = 'ij';
//var to identify if this is a searchrequest
var searchidentifier = '1s2e3a4r5c6h7s8e9a0r1c2h3';
var userinputFirst = "demo";
var paramsJSON = {
"identifier" : searchidentifier,
"operation" : operation,
"id" : id,
"userinput" : userinputFirst,
"silo" : silo
}
ajaxRequest.open("POST", ijpagename, false);
ajaxRequest.send(JSON.stringify(paramsJSON));
//setResponse(JSON.parse(ajaxRequest.responseText));
ajaxRequest = getAjaxRequestObject();
userinputFirst = 'test';
var paramsJSON = {
"identifier" : searchidentifier,
"operation" : operation,
"user" : user,
"id" : id,
"userinput" : userinputFirst,
"silo" : silo
}
ajaxRequest.open("POST", ijpagename, false);
ajaxRequest.send(JSON.stringify(paramsJSON));
setResponse(JSON.parse(ajaxRequest.responseText));
//reset confirmationid
confirmationid = '';
//stop timer
responseReceived = 1;
//scroll to bottom
location.href="#bottomhref";
document.getElementById("userinput").focus();
}
//function to process confirmation
function configureUser(){
//set message
setJini("Configuring IJ for New User.")
monitorResponseTime();
ajaxRequest = getAjaxRequestObject();
var operation = 'ij';
//var to identify if this is a searchrequest
var searchidentifier = '1s2e3a4r5c6h7s8e9a0r1c2h3';
var userinputFirst = "n";
var paramsJSON = {
"identifier" : searchidentifier,
"operation" : operation,
"user" : user,
"id" : id,
"userinput" : userinputFirst,
"silo" : silo
}
ajaxRequest.open("POST", ijpagename, false);
ajaxRequest.send(JSON.stringify(paramsJSON));
//setResponse(JSON.parse(ajaxRequest.responseText));
ajaxRequest = getAjaxRequestObject();
userinputFirst = confirmationid;
var paramsJSON = {
"identifier" : searchidentifier,
"operation" : operation,
"user" : user,
"id" : id,
"userinput" : userinputFirst,
"silo" : silo
}
ajaxRequest.open("POST", ijpagename, false);
ajaxRequest.send(JSON.stringify(paramsJSON));
setResponse(JSON.parse(ajaxRequest.responseText));
//reset confirmationid
confirmationid = '';
//stop timer
responseReceived = 1;
}
//method to get parameters from url. Use: fType = getUrlVars()["type"];
function getUrlVars() {
var vars = {};
var parts = window.location.href.replace(/[?&]+([^=&]+)=([^&]*)/gi,
function(m,key,value) {
vars[key] = value;
});
return vars;
}
//method to check if string in empty. use: empty(null) // true
function empty(e) {
switch(e) {
case "":
case 0:
case "0":
case null:
case undefined:
case "undefined":
case false:
case typeof this == "undefined":
return true;
default : return false;
}
}
//flag to indicate if response received. Its possible that user send 2nd request without
//receving response for the 1st request, in such case response of 1st request should not
//be shown
var newrequestsent;
newrequestsent = 0;
function send(){
// "`" is reserved character so replace "`" with "'" in all user input
//also replace all "~" with "'" in all user input
document.getElementById("userinput").value = document.getElementById("userinput").value.replace(/\`/g,"'");
document.getElementById("userinput").value = document.getElementById("userinput").value.replace(/\~/g,"'");
//also all backward slashes need to be replaced by backslash
document.getElementById("userinput").value = document.getElementById("userinput").value.replace(/\\/g,"/");
arrowkeypressedjustbefore = 'false';
var userinput = document.getElementById("userinput").value.trim();
//if question type is password, user userinputplain
if(questionType == 'password'){
userinput = userinputplain;
}
var deleteditems = '';
var copyitems = '';
var moveitems = '';
//currentQuestionType
//alert("currentQuestionType: " + currentQuestionType);
//alert("currCommand: " + currCommand);
//handle 'move' command
if(currCommand == 'move' && currentQuestionType != 'confirmmove'){
//get all selected items or category
//first part of input will be new topic
moveitems = "`" + userinput + '`';
//flag to stop processing of checkboxes
var done = false;
//flag to indicate if any checkbox was selected. If no checkbox is selected
//then it would mean that user as decided to cancel and is trying to search
//for something else
var checkboxchecked = '0';
//alert('latestcheckboxidForMove: ' + latestcheckboxidForMove);
for(var i = 0 ; i < 100000 && !done ; i++){
var clickedCheckboxName = document.getElementById(latestcheckboxidForMove + "-" +i);
if(clickedCheckboxName){
if(clickedCheckboxName.checked){
moveitems += clickedCheckboxName.value + '`';
//set falg to '1'
checkboxchecked = '1';
}
}
else{
done = true;
}
}
userinput = moveitems;
if(checkboxchecked == '0'){
if(document.getElementById("userinput").value.trim().length == 0){
return;
}
else{
//assume that its case of search
currCommand = '';
//reset userinput
userinput = document.getElementById("userinput").value.trim();
}
}
else{
//make sure that user has input topic to be updated
if(document.getElementById("userinput").value.trim().length == 0){
setJini(' Topic name missing. Please re-select items to be moved and input topic name to which items need to be moved to.');
return;
}
}
//alert("moveitems: " + moveitems);
}
//handle 'copy' command
if(currCommand == 'copy' && currentQuestionType != 'confirmcopy'){
//get all selected items or category
//first part of input will be new topic
copyitems = "`" + userinput + '`';
//flag to stop processing of checkboxes
var done = false;
//flag to indicate if any checkbox was selected. If no checkbox is selected
//then it would mean that user as decided to cancel and is trying to search
//for something else
var checkboxchecked = '0';
//alert('latestcheckboxidForCopy:' + latestcheckboxidForCopy);
for(var i = 0 ; i < 100000 && !done ; i++){
var clickedCheckboxName = document.getElementById(latestcheckboxidForCopy + "-" +i);
if(clickedCheckboxName){
if(clickedCheckboxName.checked){
copyitems += clickedCheckboxName.value + '`';
//set falg to '1'
checkboxchecked = '1';
}
}
else{
done = true;
}
}
userinput = copyitems;
if(checkboxchecked == '0'){
if(document.getElementById("userinput").value.trim().length == 0){
return;
}
else{
//assume that its case of search
currCommand = '';
//reset userinput
userinput = document.getElementById("userinput").value.trim();
}
}
else{
//make sure that user has input topic to be updated
if(document.getElementById("userinput").value.trim().length == 0){
setJini(' Topic name missing. Please re-select items to be copied and input topic name to which items need to be copied to.');
return;
}
}
//alert("copyitems: " + copyitems);
}
//handle 'delete' command
if(currCommand == 'delete' && currentQuestionType != 'confirmdelete'){
//get all selected items or category
//first item is category, if category is selected then just need to send the category
var clickedCheckboxName = document.getElementById(latestcheckboxidForDelete + "-" + '0');
if(clickedCheckboxName && clickedCheckboxName.checked){
deleteditems = clickedCheckboxName.value + '`';
}
else{
//flag to stop processing of checkboxes
var done = false;
var checkboxchecked = '0';
for(var i = 1 ; i < 100000 && !done ; i++){
var clickedCheckboxName = document.getElementById(latestcheckboxidForDelete + "-" +i);
if(clickedCheckboxName){
if(clickedCheckboxName.checked){
deleteditems += clickedCheckboxName.value + '`';
checkboxchecked = '1';
}
}
else{
done = true;
}
}
}
userinput = deleteditems;
if(checkboxchecked == '0'){
//assume that its case of search
currCommand = '';
}
if(userinput.trim().length == 0){
userinput = document.getElementById("userinput").value.trim();
}
//still empty ?
if(userinput.trim().length == 0){
userinput = '`';
}
}
//handle edit command
if(currCommand == 'edit' && radiobuttonclicked){
//edit last item
shownewvalue(lastselectedradioid)
userinput = '';
for (i in editedItemsArray) {
userinput += i + '`' + editedItemsArray[i] + '`';
// outputs: one:First, two:Second, three:Third
}
//reset flag
radiobuttonclicked = false;
//alert(userinput);
//return;
}
//handle add command
if(currCommand == 'insert'){
//ignore if user entered empty string
if(userinput.trim().length == 0){
return;
}
if(radiobuttonclickedforadd){
//set the value to the selected radio button - 1
//so that record is inserted before the selected item
userinput = lastselectedradiovalueforadd;
}
else{
//user wants to add item to the end of the list
userinput = new Date().getTime();
}
userinput += "`" + document.getElementById("userinput").value.trim();
}
//reset flag
radiobuttonclickedforadd = false;
if(userinput.length == 0){
return;
}
reset();
var ajaxRequest; // The variable that makes Ajax possible!
try{
// Opera 8.0+, Firefox, Safari
ajaxRequest = new XMLHttpRequest();
} catch (e){
// Internet Explorer Browsers
try{
ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try{
ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
} catch (e){
// Something went wrong
alert("Your browser broke!");
return false;
}
}
}
// Create a function that will receive data sent from the server
ajaxRequest.onreadystatechange = function(){
try
{
if(ajaxRequest.readyState == 4 && newrequestsent == 1){
//alert("ajaxRequest.responseText: " + ajaxRequest.responseText);
respData = JSON.parse(ajaxRequest.responseText);
responseReceived = 1;
setResponse(respData);
//since response has been received mark flag newrequestsent
newrequestsent = 0;
}
}
catch(exception)
{
//do nothing
}
}
var operation = 'ij';
//var to identify if this is a searchrequest
var searchidentifier = '1s2e3a4r5c6h7s8e9a0r1c2h3';
var paramsJSON = {
"identifier" : searchidentifier,
"operation" : operation,
"user" : user,
"requestid" : requestid,
"id" : id,
"status" : status,
"userinput" : userinput,
"silo" : silo
}
//set newrequestsent to mark that request is being send
newrequestsent = 1;
ajaxRequest.open("POST", ijpagename, true);
ajaxRequest.send(JSON.stringify(paramsJSON));
//reset responseReceived
responseReceived = 0;
//do some activity to make sure user knows that ij is working
monitorResponseTime();
//reset
currCommand = '';
currentQuestionType = '';
//increment requestid
requestid = Number(requestid) + Number('1');
}
function monitorResponseTime()
{
document.getElementById('ij').innerHTML += ".";
setTimeout("delayMessage();",1000);
}
//flag to indicate if radio button was clicked
var radiobuttonclicked = false;
//id of last clicked radio
var lastselectedradioid = '';
function radiobuttonClicked(id){
//identify which item was clicked
//alert(document.getElementById(id).value);
radiobuttonclicked = true;
var selectedval = document.getElementById('div-'+id).innerHTML;
if(lastselectedradioid != ''){
shownewvalue(lastselectedradioid);
}
//set value in input box
document.getElementById("userinput").value = selectedval;
lastselectedradioid = id;
//focus userinpu
focusUserInput();
}
//flag to indicate if radio button was clicked
var radiobuttonclickedforadd = false;
//id of last clicked radio
var lastselectedradioidforadd = '';
//timestampmilisec of selected
var lastselectedradiovalueforadd = '';
function radiobuttonClickedForAdd(id){
//identify which item was clicked
//alert(document.getElementById(id).value);
radiobuttonclickedforadd = true;
lastselectedradioidforadd = id;
lastselectedradiovalueforadd = document.getElementById(id).value;
//focus userinput
focusUserInput();
}
//array to keep track of changes
var editedItemsArray = [];
//function to display edited value
function shownewvalue(oldid){
var userInput = document.getElementById("userinput").value.replace(/\`/g,"'").trim();
userInput = userInput.replace(/\~/g,"'").trim();
if(userInput == ''){
return;
}
//document.getElementById(oldid).value = document.getElementById("userinput").value;
editedItemsArray[document.getElementById(oldid).value] = userInput;
document.getElementById('div-'+oldid).innerHTML = userInput;
//alert(document.getElementById("userinput").value);
//showEditedItemsArray();
}
function showEditedItemsArray()
{
var response = '';
for (i in editedItemsArray) {
response += i + ':' + editedItemsArray[i] + ', ';
// outputs: one:First, two:Second, three:Third
}
alert(response);
}
//this method will be called everytime checkbox is clicked for delete
function checkBoxClicked(counter)
{
//flag to indicate if all checklists have been selected
var done = false;
//if counter is zero that means category has been selected
//so select all items belonging to the category
//alert('latestcheckboxidForDelete : ' + latestcheckboxidForDelete);
//alert('counter : ' + counter);
//alert('respData.requestid : ' + respData.requestid);
if(counter == 0){
if(document.getElementById(latestcheckboxidForDelete + '-' + counter).checked){
for(var i = 1 ; i < 100000 && !done ; i++){
var clickedCheckboxName = document.getElementById(latestcheckboxidForDelete + '-' + i);
if(clickedCheckboxName){
clickedCheckboxName.checked = true;
}
else{
done = true;
}
}
}
else{
for(var i = 1 ; i < 100000 && !done ; i++){
var clickedCheckboxName = document.getElementById(latestcheckboxidForDelete + '-' + i);
if(clickedCheckboxName){
clickedCheckboxName.checked = false;
}
else{
done = true;
}
}
}
}
}
function delayMessage()
{
if(responseReceived == 0)
{
document.getElementById('ij').innerHTML += ".";
location.href="#bottomhref";
monitorResponseTime();
}
}
function main(){
//if url contains confirmation id, then automatically process confirmation id
confirmationid = getUrlVars()["confirmationid"];
//if confirmation id is not null, then process confirmation id
if(!empty(confirmationid)){
welcome();
}
//set focus on button
document.getElementById('signupinbutton').focus();
checkifijisdisplayed();
}
function welcome(){
var e1 = document.getElementById('startij');
e1.style.display = 'block';
//remove background image
document.body.style.backgroundImage = "none";
//document.body.style.background = '';
hidelandingpage();
//if url contains confirmation id, then automatically process confirmation id
confirmationid = getUrlVars()["confirmationid"];
//init output
initJini();
var ajaxRequest; // The variable that makes Ajax possible!
try{
// Opera 8.0+, Firefox, Safari
ajaxRequest = new XMLHttpRequest();
} catch (e){
// Internet Explorer Browsers
try{
ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try{
ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
} catch (e){
// Something went wrong
alert("Your browser broke!");
return false;
}
}
}
var operation = 'ij';
//var to identify if this is a searchrequest
var searchidentifier = '1s2e3a4r5c6h7s8e9a0r1c2h3';
var userinputFirst = "";
var paramsJSON = {
"identifier" : searchidentifier,
"operation" : operation,
"user" : user,
"id" : id,
"userinput" : userinputFirst,
"silo" : silo
}
ajaxRequest.open("POST", ijpagename, false);
ajaxRequest.send(JSON.stringify(paramsJSON));
//process any automatic processing to be done
//based on current url
processurlinitialization(JSON.parse(ajaxRequest.responseText));
}
function showhelp(){
//remove logic during development
//return "";
//don't show help in case command is edit/delete
if(currCommand == 'delete' || currCommand == 'edit' || currCommand == 'insert'){
return;
}
var userinput = document.getElementById("userinput").value.replace('*','').trim();
//if userinput size is more then one and hint select is 4 or less then don't request for more help
if(userinput.length > 1 && document.getElementById("hintcategory").length <= 4){
return;
}
if(userinput.length == 0 || status == ""){
//reset hint drowdown
removeHintOptions();
//hide select box
document.getElementById('hintcategory').style.display = 'none';
return;
}
//also return if arrowkeypressedjustbefore = true;
if(arrowkeypressedjustbefore == 'true'){
arrowkeypressedjustbefore = 'false';
return;
}
var ajaxRequest; // The variable that makes Ajax possible!
try{
// Opera 8.0+, Firefox, Safari
ajaxRequest = new XMLHttpRequest();
} catch (e){
// Internet Explorer Browsers
try{
ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try{
ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
} catch (e){
// Something went wrong
alert("Your browser broke!");
return false;
}
}
}
// Create a function that will receive data sent from the server
ajaxRequest.onreadystatechange = function(){
try
{
if(ajaxRequest.readyState == 4){
respData = JSON.parse(ajaxRequest.responseText);
responseReceived = 1;
populateHelp(respData);
}
}
catch(exception)
{
//do nothing
}
}
var operation = 'ijhelp';
//var to identify if this is a searchrequest
var searchidentifier = '1s2e3a4r5c6h7s8e9a0r1c2h3';
var paramsJSON = {
"identifier" : searchidentifier,
"operation" : operation,
"user" : user,
"id" : id,
"userinput" : userinput,
"silo" : silo
}
ajaxRequest.open("POST", ijpagename, true);
ajaxRequest.send(JSON.stringify(paramsJSON));
//alert("userinput: '" + userinput +"'");
}
function reset(){
if(document.getElementById("userinput") != null
&&
document.getElementById("userinput").value.trim().length > 0){
if(user.length > 0){
setJini('' + user + ': ' + document.getElementById("userinput").value.trim() + '');
}
else{
setJini('' + 'User: ' + document.getElementById("userinput").value.trim() + '');
}
}
userinputplain = '';
staredinput = '';
document.getElementById("userinput").value = "";
}
//current command
var currCommand = '';
//current question type
var currentQuestionType = "";
//question type
var questionType = '';
//actualinput in case of password
var userinputplain = '';
function setResponse(respData){
//currCommand
currCommand = respData.command;
//current question type
currentQuestionType = respData.questiontype;
if(currCommand == 'delete' && currentQuestionType != 'confirmdelete'){
latestcheckboxidForDelete = respData.requestid;
}
else if(currCommand == 'copy' && currentQuestionType != 'confirmcopy'){
latestcheckboxidForCopy = respData.requestid;
}
else if(currCommand == 'move' && currentQuestionType != 'confirmmove'){
latestcheckboxidForMove = respData.requestid;
}
//set user id
id = respData.id;
//set user
user = respData.user;
//set status
status = respData.status;
//alert(respData.response);
setJini('' + respData.response + '');
questionType = respData.questiontype;
if(questionType == 'password'){
document.onkeyup = encodeKey;
}
else{
document.onkeyup = donothing;
}
}
//flag to keep track if arrow key was pressed
var arrowkeypressedjustbefore = 'false';
var staredinput = '';
function processKey(e)
{
if (null == e)
{
e = window.event ;
}
if (e.keyCode == 13)
{
arrowkeypressedjustbefore = 'false';
send();
}
else if (e.keyCode == 40)
{
//alert(document.getElementById("userinput").value);
arrowkeypressedjustbefore = 'true';
//need to something only when there userinput is not empty
var userinput = document.getElementById("userinput").value.replace('*','').trim();
if(userinput.length == 0 || status == ""){
return;
}
//select value from dropdown
updateuserinputDownKey()
}
else if (e.keyCode == 38)
{
arrowkeypressedjustbefore = 'true';
//need to something only when there userinput is not empty
var userinput = document.getElementById("userinput").value.replace('*','').trim();
if(userinput.length == 0 || status == ""){
return;
}
//select value from dropdown
updateuserinputUpKey()
}
}
function donothing(){
}
function encodeKey(e)
{
if (null == e)
{
e = window.event ;
}
//if (e.keyCode == 8 || )
//if question type is password, do not show clear text
if(questionType == 'password' ){
//alert(document.getElementById("userinput").value);
var userinputval = document.getElementById("userinput").value.trim();
if(userinputval.length == 0){
document.getElementById("userinput").value ='';
return;
}
//process only if length of input field changes
if(userinputplain.length != userinputval.length){
//if userinputplain.length is 0 then it would mean that
//user is inputing value for the first time
if(userinputplain.length == 0 && userinputval.length > 0 ){
userinputplain = userinputval;
//hide userinputval
document.getElementById("userinput").value = '';
for(var i =0 ; i < userinputplain.length; i++){
document.getElementById("userinput").value += '*';
}
staredinput = document.getElementById("userinput").value;
}
else if(userinputplain.length < userinputval.length){
//user added a letter
var lastchar = userinputval.substr(userinputval.length-1);
userinputplain = userinputplain + lastchar;
staredinput += '*';
document.getElementById("userinput").value = staredinput;
}
else{
userinputplain = userinputplain.substr(0,userinputplain.length-1);
staredinput = staredinput.substr(0,staredinput.length-1);
}
}
}
}
function updateuserinputUpKey() {
//iterate through drop down values and select next to the currently selected
//if no value selected, select first one
//flag to indicate if value was already selected
var alreadyselected = false;
var combo = document.getElementById("hintcategory");
var hintTokenArray = combo.options.length;
for ( var i = 0; i < hintTokenArray; ++i ){
if(combo.selectedIndex != -1 && combo.options[combo.selectedIndex].text == combo.options[i].text){
document.getElementById('hintcategory')[i - Number(1)].selected = "1";
setuserinput(document.getElementById('hintcategory').value);
//document.getElementById("userinput").value = document.getElementById('hintcategory').value + " *";
alreadyselected = true;
i = hintTokenArray;
}
}
if(!alreadyselected){
//down arrow key pressed so select first element of combobox
document.getElementById('hintcategory')[0].selected = "1";
//set value of user input
setuserinput(document.getElementById('hintcategory').value);
//document.getElementById("userinput").value = document.getElementById('hintcategory').value + " *";
}
}
function updateuserinputDownKey() {
//iterate through drop down values and select next to the currently selected
//if no value selected, select first one
//flag to indicate if value was already selected
var alreadyselected = false;
var combo = document.getElementById("hintcategory");
var hintTokenArray = combo.options.length;
for ( var i = 0; i < hintTokenArray; ++i ){
if(combo.selectedIndex != -1 && combo.options[combo.selectedIndex].text == combo.options[i].text){
var newIndex = i + Number(1);
//if next option is blank then just ignore
if(combo.options[newIndex].text.trim() == "" || combo.options[newIndex].text.trim().indexOf("nbsp") > 0){
return;
}
document.getElementById('hintcategory')[newIndex].selected = "1";
setuserinput(document.getElementById('hintcategory').value);
//document.getElementById("userinput").value = document.getElementById('hintcategory').value + " *";
alreadyselected = true;
i = hintTokenArray;
}
}
if(!alreadyselected){
//down arrow key pressed so select first element of combobox
document.getElementById('hintcategory')[0].selected = "1";
//set value of user input
setuserinput(document.getElementById('hintcategory').value);
//document.getElementById("userinput").value = document.getElementById('hintcategory').value + " *";
}
}
String.prototype.trim = function() {
return this.replace(/^\s+|\s+$/g, "");
};
function moveCaretToEnd(el) {
if (typeof el.selectionStart == "number") {
el.selectionStart = el.selectionEnd = el.value.length;
} else if (typeof el.createTextRange != "undefined") {
el.focus();
var range = el.createTextRange();
range.collapse(false);
range.select();
}
}
//add empty space in output box so that ij appear to start from bottom
function initJini(){
document.getElementById('ij').innerHTML = '';
}
//save last command, as it need to be shown in case user clears the screen
var lastIJMessage = '';
//clear all the content shown till now
function clearIJ(){
//document.getElementById('ij').innerHTML = lastIJMessage;
document.getElementById('ij').innerHTML = '
';
//bring curson to the end in ij text area
//moveCaretToEnd(document.getElementById('ij'));
location.href="#bottomhref";
//for chrome
var objDiv = document.getElementById("ijparent");
objDiv.scrollTop = objDiv.scrollHeight;
//focus input text area
document.getElementById("userinput").focus();
}
//initiate backup
var backupwindowref;
function takeBackup(){
//if backup button is pressed but status is not 'ready' then ask user to login
if(!(status == 'ready')){
setJini(" Please login before taking backup.");
return;
}
//disable backup button
document.getElementById("Backup").disabled = true;
//show message
setJini(" Starting backup, backup data will be shown in a new window. Please make sure that popups are not blocked.");
setJini(" Create backup file by saving the file locally, use option: File->Save Page As on the popup window.");
//open new window and display user message
backupwindowref = window.open('IJBackup','IJBackup', 'width=950,height=750'+',menubar=1'+',toolbar=0'+',status=0'+',scrollbars=1'+',resizable=1');
//send request for backup
var ajaxRequest; // The variable that makes Ajax possible!
try{
// Opera 8.0+, Firefox, Safari
ajaxRequest = new XMLHttpRequest();
} catch (e){
// Internet Explorer Browsers
try{
ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try{
ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
} catch (e){
// Something went wrong
alert("Your browser broke!");
return false;
}
}
}
// Create a function that will receive data sent from the server
ajaxRequest.onreadystatechange = function(){
try
{
if(ajaxRequest.readyState == 4){
respData = JSON.parse(ajaxRequest.responseText);
if(respData.response != null){
backupwindowref.document.writeln('' + respData.response + '');
}
else{
//backupwindowref.document.writeln("Sorry, couldn't process your request right now, please try again in 1 hr.");
backupwindowref.close();
setJini(" Sorry, couldn't process your request right now, please try again in 1 hr.");
}
document.getElementById("Backup").disabled = false;
}
}
catch(exception)
{
//do nothing
}
}
var operation = 'ij';
var userinput = 'b';
//var to identify if this is a searchrequest
var searchidentifier = '1s2e3a4r5c6h7s8e9a0r1c2h3';
var paramsJSON = {
"identifier" : searchidentifier,
"operation" : operation,
"user" : user,
"id" : id,
"userinput" : userinput,
"silo" : silo
}
ajaxRequest.open("POST", ijpagename, true);
ajaxRequest.send(JSON.stringify(paramsJSON));
}
function setJini(message){
lastIJMessage = message;
//alert(message.trim());
if(message.trim().length == 0){
return;
}
if(document.getElementById('ij').innerHTML.length > 0){
//document.getElementById('ij').value = document.getElementById('ij').value + "\n" + message.trim();
document.getElementById('ij').innerHTML += '
';
}
//bring curson to the end in ij text area
//moveCaretToEnd(document.getElementById('ij'));
location.href="#bottomhref";
//for chrome
var objDiv = document.getElementById("ijparent");
objDiv.scrollTop = objDiv.scrollHeight;
//focus input text area
document.getElementById("userinput").focus();
}
function removeHintOptions(){
//show combo box
document.getElementById('hintcategory').style.display = 'block';
//remove options
var elSel = document.getElementById('hintcategory');
var i;
for (i = elSel.length - 2; i>=0; i--) {
elSel.remove(i);
}
}
function populateHelp(respData){
//alert("respData: " + respData.hint);
//first remove all the options
removeHintOptions();
//parse hint, hint will be in format hint word1` hint word2 .....
//so need to tokenize base on "`"
if(respData.hint.indexOf("`") > 0){
var hintTokenArray = respData.hint.split("`");
var combo = document.getElementById("hintcategory");
for ( var i = 0; i < hintTokenArray.length; ++i ){
//alert("hintTokenArray[i]: " + hintTokenArray[i]);
var option = document.createElement("option");
option.text = hintTokenArray[i];
option.value = hintTokenArray[i];
try {
combo.add(option,i); //Standard
}catch(error) {
}
try {
combo.add(option, elSel.options[i]); //Standard
}catch(error) {
}
try {
combo.add(option,combo.options[i]); // IE only
}catch(error) {
}
}
//select first option
combo.selected = "0";
}
else{
//hide combo box
document.getElementById('hintcategory').style.display = 'none';
}
//scroll to the bottom of the page
location.href="#bottomhref";
//focus user input
focusUserInput();
}
function setuserinput(val) {
if(val.trim() == "" || val.trim() == "-1"){
return;
}
if(currCommand == 'move' || currCommand == 'copy'){
document.getElementById("userinput").value = val;
}
else{
//add '*' as well to mark it as category
document.getElementById("userinput").value = val + " *";
}
}
//this will be called when topic hyperlink is clicked
function searchTopic(inputval) {
document.getElementById("userinput").value = inputval + " *";
send();
}
//-->
Welcome To
IJ
It's like having your own Personal IBM Watson*. IJ remembers, links, and makes available to you all your information/data:Notes; Contacts; Calendar; Reminders; etc, as chat. Login and start adding information/data.
Press 'j' to add items to default topic 'Misc'; Press 's' to email search results; Press 'f' to add users to share group; Press 'g' to change repository.
You could use following, alone or in combination, for more feature rich search: * : Topic only search;
? : Match any of the search words;
+ : Return extended results;