Rushabh Mehta | 66ac2b0 | 2011-09-05 18:43:09 +0530 | [diff] [blame^] | 1 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> |
| 2 | <head> |
| 3 | <meta charset="utf-8"> |
| 4 | <title>ERPNext</title> |
| 5 | <meta name="author" content=""> |
| 6 | <script type="text/javascript">var asset_timestamps_={"lib/js/lib/history/history.adapter.jquery.js": "1310718903", "lib/js/lib/history/history.min.js": "1315221478", "lib/js/wn/history.js": "1313759392", "lib/js/lib/superfish/superfish.min.js": "1315222973", "lib/js/legacy/jquery/jquery.jqplot.min.js": "1313994339", "lib/js/legacy/wnf.compressed.js": "1315227202", "js/app.js": "1315226253", "lib/css/layout.css": "1313603562", "lib/css/base.css": "1314774281", "lib/js/legacy/wn/modules.js": "1311752688", "lib/js/lib/history/history.html4.js": "1310718903", "lib/js/core.min.js": "1315225602", "lib/js/legacy/user.js": "1311752688", "lib/css/legacy/jquery-ui.css": "1311752687", "lib/js/legacy/wn/widgets/doc_column_view.js": "1311752688", "lib/js/legacy/widgets/report_builder/bargraph.js": "1311752688", "lib/css/legacy/user.css": "1311752687", "lib/css/legacy/default.css": "1315222973", "lib/js/legacy/jquery/jquery-ui.min.js": "1315220242", "config/_timestamps.js": "1315228305", "lib/js/legacy/form.compressed.js": "1315222973", "lib/js/legacy/widgets/form/attachments.js": "1315219428", "templates/index.html": "1315223202", "lib/js/legacy/report.compressed.js": "1315222973", "lib/css/skeleton.css": "1313603562", "lib/js/legacy/wn/widgets/filters.js": "1311752688", "index.html": "1315228304", "lib/js/legacy/widgets/print_query.js": "1311752688", "lib/js/lib/jquery.min.js": "1313062880", "lib/js/lib/history/history.js": "1310718903", "lib/js/legacy/wn/widgets/follow.js": "1311752688"} |
| 7 | // provide a namespace |
| 8 | wn = {} |
| 9 | wn.provide = function(namespace) { |
| 10 | var nsl = namespace.split('.'); |
| 11 | var l = nsl.length; |
| 12 | var parent = window; |
| 13 | for(var i=0; i<l; i++) { |
| 14 | var n = nsl[i]; |
| 15 | if(!parent[n]) { |
| 16 | parent[n] = {} |
| 17 | } |
| 18 | parent = parent[n]; |
| 19 | } |
| 20 | } |
| 21 | wn.xmlhttp = { |
| 22 | request: function() { |
| 23 | if ( window.XMLHttpRequest ) // Gecko |
| 24 | return new XMLHttpRequest() ; |
| 25 | else if ( window.ActiveXObject ) // IE |
| 26 | return new ActiveXObject("MsXml2.XmlHttp") ; |
| 27 | }, |
| 28 | |
| 29 | complete: function(req, callback, url) { |
| 30 | if (req.status==200 || req.status==304) { |
| 31 | callback(req.responseText); |
| 32 | } else { |
| 33 | alert(url +' request error: ' + req.statusText + ' (' + req.status + ')' ) ; |
| 34 | } |
| 35 | }, |
| 36 | |
| 37 | get: function(url, callback, async) { |
| 38 | // async by default |
| 39 | if(async === null) async=true; |
| 40 | var req = wn.xmlhttp.request(); |
| 41 | |
| 42 | // for async type |
| 43 | req.onreadystatechange = function() { |
| 44 | if (req.readyState==4) { |
| 45 | wn.xmlhttp.complete(req, callback, url) |
| 46 | } |
| 47 | } |
| 48 | req.open('GET', url, async); |
| 49 | req.send(null); |
| 50 | |
| 51 | // for sync |
| 52 | if(!async) { |
| 53 | wn.xmlhttp.complete(req, callback, url) |
| 54 | } |
| 55 | } |
| 56 | } |
| 57 | |
| 58 | // library to mange assets (js, css, models, html) etc in the app. |
| 59 | // will try and get from localStorge if latest are available |
| 60 | // or will load them via xmlhttp |
| 61 | // depends on asset_timestamps_ loaded via boot |
| 62 | |
| 63 | wn.assets = { |
| 64 | // keep track of executed assets |
| 65 | executed_ : {}, |
| 66 | |
| 67 | // check if the asset exists in |
| 68 | // localstorage and if the timestamp |
| 69 | // matches with the loaded timestamp |
| 70 | exists: function(src) { |
| 71 | if('localStorage' in window |
| 72 | && localStorage.getItem(src) |
| 73 | && localStorage.getItem('[ts] '+src) == asset_timestamps_[src]) |
| 74 | return true |
| 75 | }, |
| 76 | |
| 77 | // add the asset to |
| 78 | // localstorage |
| 79 | add: function(src, txt) { |
| 80 | if('localStorage' in window) { |
| 81 | localStorage.setItem(src, txt); |
| 82 | localStorage.setItem('[ts] ' + src, asset_timestamps_[src]); |
| 83 | } |
| 84 | }, |
| 85 | |
| 86 | get: function(src) { |
| 87 | return localStorage.getItem(src); |
| 88 | }, |
| 89 | |
| 90 | extn: function(src) { |
| 91 | return src.split('.').slice(-1)[0]; |
| 92 | }, |
| 93 | |
| 94 | html_src: function(src) { |
| 95 | if(src.indexOf('/')!=-1) { |
| 96 | var t = src.split('/').slice(0,-1); |
| 97 | t.push('src'); |
| 98 | t = t.join('/') +'/' + a.split('/').slice(-1)[0]; |
| 99 | } else { |
| 100 | var t = 'src/' + src; |
| 101 | } |
| 102 | return t; |
| 103 | }, |
| 104 | |
| 105 | // load an asset via |
| 106 | // xmlhttp |
| 107 | load: function(src) { |
| 108 | var t = wn.assets.extn(src)=='html' ? wn.assets.html_src(src) : src; |
| 109 | |
| 110 | wn.xmlhttp.get(t, function(txt) { |
| 111 | // add it to localstorage |
| 112 | wn.assets.add(src, txt); |
| 113 | }, false) |
| 114 | }, |
| 115 | |
| 116 | // pass on to the handler to set |
| 117 | execute: function(src) { |
| 118 | if(!wn.assets.exists(src)) { |
| 119 | wn.assets.load(src); |
| 120 | } |
| 121 | var type = wn.assets.extn(src); |
| 122 | if(wn.assets.handler[type]) { |
| 123 | wn.assets.handler[type](wn.assets.get(src), src); |
| 124 | wn.assets.executed_[src] = 1; |
| 125 | } |
| 126 | }, |
| 127 | |
| 128 | // handle types of assets |
| 129 | // and launch them in the |
| 130 | // app |
| 131 | handler: { |
| 132 | js: function(txt, src) { |
| 133 | wn.dom.eval(txt); |
| 134 | }, |
| 135 | css: function(txt, src) { |
| 136 | var se = document.createElement('style'); |
| 137 | se.type = "text/css"; |
| 138 | if (se.styleSheet) { |
| 139 | se.styleSheet.cssText = txt; |
| 140 | } else { |
| 141 | se.appendChild(document.createTextNode(txt)); |
| 142 | } |
| 143 | document.getElementsByTagName('head')[0].appendChild(se); |
| 144 | }, |
| 145 | html: function(txt, src) { |
| 146 | // make the html content page |
| 147 | var page = wn.dom.add($('.outer .inner').get(0), 'div', 'content', null, txt); |
| 148 | page.setAttribute("_src", src); |
| 149 | } |
| 150 | } |
| 151 | } |
| 152 | |
| 153 | // require js file |
| 154 | wn.require = function(items) { |
| 155 | if(typeof items === "string") { |
| 156 | items = [items]; |
| 157 | } |
| 158 | var l = items.length; |
| 159 | |
| 160 | for(var i=0; i< l; i++) { |
| 161 | var src = items[i]; |
| 162 | if(!(src in wn.assets.executed_)) { |
| 163 | // check if available in localstorage |
| 164 | wn.assets.execute(src) |
| 165 | } |
| 166 | } |
| 167 | } |
| 168 | // add a new dom element |
| 169 | wn.provide('wn.dom'); |
| 170 | |
| 171 | wn.dom.by_id = function(id) { |
| 172 | return document.getElementById(id); |
| 173 | } |
| 174 | |
| 175 | wn.dom.eval = function(txt) { |
| 176 | var el = document.createElement('script'); |
| 177 | el.appendChild(document.createTextNode(txt)); |
| 178 | // execute the script globally |
| 179 | document.getElementsByTagName('head')[0].appendChild(el); |
| 180 | } |
| 181 | |
| 182 | wn.dom.add = function(parent, newtag, className, cs, innerHTML, onclick) { |
| 183 | if(parent && parent.substr)parent = wn.dom.by_id(parent); |
| 184 | var c = document.createElement(newtag); |
| 185 | if(parent) |
| 186 | parent.appendChild(c); |
| 187 | |
| 188 | // if image, 3rd parameter is source |
| 189 | if(className) { |
| 190 | if(newtag.toLowerCase()=='img') |
| 191 | c.src = className |
| 192 | else |
| 193 | c.className = className; |
| 194 | } |
| 195 | if(cs) wn.dom.css(c,cs); |
| 196 | if(innerHTML) c.innerHTML = innerHTML; |
| 197 | if(onclick) c.onclick = onclick; |
| 198 | return c; |
| 199 | } |
| 200 | |
| 201 | // add css to element |
| 202 | wn.dom.css = function(ele, s) { |
| 203 | if(ele && s) { |
| 204 | for(var i in s) ele.style[i]=s[i]; |
| 205 | }; |
| 206 | return ele; |
| 207 | } |
| 208 | wn.page = { |
| 209 | set: function(src) { |
| 210 | var new_selection = $('.inner div.content[_src="'+ src +'"]'); |
| 211 | if(!new_selection.length) { |
| 212 | // get from server / localstorage |
| 213 | wn.assets.execute(src); |
| 214 | new_selection = $('.inner div.content[_src="'+ src +'"]'); |
| 215 | } |
| 216 | |
| 217 | // hide current |
| 218 | $('.inner .current_page').removeClass('current_page'); |
| 219 | |
| 220 | // show new |
| 221 | new_selection.addClass('current_page'); |
| 222 | |
| 223 | // get title (the first h1, h2, h3) |
| 224 | var title = $('nav ul li a[href*="' + src + '"]').attr('title') || 'No Title' |
| 225 | |
| 226 | // replace state (to url) |
| 227 | state = History.getState(); |
| 228 | if(state.hash!=src) { |
| 229 | History.replaceState(null, title, src); |
| 230 | } |
| 231 | else { |
| 232 | document.title = title; |
| 233 | } |
| 234 | } |
| 235 | } |
| 236 | /* |
| 237 | http://www.JSON.org/json2.js |
| 238 | 2011-02-23 |
| 239 | |
| 240 | Public Domain. |
| 241 | |
| 242 | NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK. |
| 243 | |
| 244 | See http://www.JSON.org/js.html |
| 245 | |
| 246 | |
| 247 | This code should be minified before deployment. |
| 248 | See http://javascript.crockford.com/jsmin.html |
| 249 | |
| 250 | USE YOUR OWN COPY. IT IS EXTREMELY UNWISE TO LOAD CODE FROM SERVERS YOU DO |
| 251 | NOT CONTROL. |
| 252 | |
| 253 | |
| 254 | This file creates a global JSON object containing two methods: stringify |
| 255 | and parse. |
| 256 | |
| 257 | JSON.stringify(value, replacer, space) |
| 258 | value any JavaScript value, usually an object or array. |
| 259 | |
| 260 | replacer an optional parameter that determines how object |
| 261 | values are stringified for objects. It can be a |
| 262 | function or an array of strings. |
| 263 | |
| 264 | space an optional parameter that specifies the indentation |
| 265 | of nested structures. If it is omitted, the text will |
| 266 | be packed without extra whitespace. If it is a number, |
| 267 | it will specify the number of spaces to indent at each |
| 268 | level. If it is a string (such as '\t' or ' '), |
| 269 | it contains the characters used to indent at each level. |
| 270 | |
| 271 | This method produces a JSON text from a JavaScript value. |
| 272 | |
| 273 | When an object value is found, if the object contains a toJSON |
| 274 | method, its toJSON method will be called and the result will be |
| 275 | stringified. A toJSON method does not serialize: it returns the |
| 276 | value represented by the name/value pair that should be serialized, |
| 277 | or undefined if nothing should be serialized. The toJSON method |
| 278 | will be passed the key associated with the value, and this will be |
| 279 | bound to the value |
| 280 | |
| 281 | For example, this would serialize Dates as ISO strings. |
| 282 | |
| 283 | Date.prototype.toJSON = function (key) { |
| 284 | function f(n) { |
| 285 | // Format integers to have at least two digits. |
| 286 | return n < 10 ? '0' + n : n; |
| 287 | } |
| 288 | |
| 289 | return this.getUTCFullYear() + '-' + |
| 290 | f(this.getUTCMonth() + 1) + '-' + |
| 291 | f(this.getUTCDate()) + 'T' + |
| 292 | f(this.getUTCHours()) + ':' + |
| 293 | f(this.getUTCMinutes()) + ':' + |
| 294 | f(this.getUTCSeconds()) + 'Z'; |
| 295 | }; |
| 296 | |
| 297 | You can provide an optional replacer method. It will be passed the |
| 298 | key and value of each member, with this bound to the containing |
| 299 | object. The value that is returned from your method will be |
| 300 | serialized. If your method returns undefined, then the member will |
| 301 | be excluded from the serialization. |
| 302 | |
| 303 | If the replacer parameter is an array of strings, then it will be |
| 304 | used to select the members to be serialized. It filters the results |
| 305 | such that only members with keys listed in the replacer array are |
| 306 | stringified. |
| 307 | |
| 308 | Values that do not have JSON representations, such as undefined or |
| 309 | functions, will not be serialized. Such values in objects will be |
| 310 | dropped; in arrays they will be replaced with null. You can use |
| 311 | a replacer function to replace those with JSON values. |
| 312 | JSON.stringify(undefined) returns undefined. |
| 313 | |
| 314 | The optional space parameter produces a stringification of the |
| 315 | value that is filled with line breaks and indentation to make it |
| 316 | easier to read. |
| 317 | |
| 318 | If the space parameter is a non-empty string, then that string will |
| 319 | be used for indentation. If the space parameter is a number, then |
| 320 | the indentation will be that many spaces. |
| 321 | |
| 322 | Example: |
| 323 | |
| 324 | text = JSON.stringify(['e', {pluribus: 'unum'}]); |
| 325 | // text is '["e",{"pluribus":"unum"}]' |
| 326 | |
| 327 | |
| 328 | text = JSON.stringify(['e', {pluribus: 'unum'}], null, '\t'); |
| 329 | // text is '[\n\t"e",\n\t{\n\t\t"pluribus": "unum"\n\t}\n]' |
| 330 | |
| 331 | text = JSON.stringify([new Date()], function (key, value) { |
| 332 | return this[key] instanceof Date ? |
| 333 | 'Date(' + this[key] + ')' : value; |
| 334 | }); |
| 335 | // text is '["Date(---current time---)"]' |
| 336 | |
| 337 | |
| 338 | JSON.parse(text, reviver) |
| 339 | This method parses a JSON text to produce an object or array. |
| 340 | It can throw a SyntaxError exception. |
| 341 | |
| 342 | The optional reviver parameter is a function that can filter and |
| 343 | transform the results. It receives each of the keys and values, |
| 344 | and its return value is used instead of the original value. |
| 345 | If it returns what it received, then the structure is not modified. |
| 346 | If it returns undefined then the member is deleted. |
| 347 | |
| 348 | Example: |
| 349 | |
| 350 | // Parse the text. Values that look like ISO date strings will |
| 351 | // be converted to Date objects. |
| 352 | |
| 353 | myData = JSON.parse(text, function (key, value) { |
| 354 | var a; |
| 355 | if (typeof value === 'string') { |
| 356 | a = |
| 357 | /^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2}(?:\.\d*)?)Z$/.exec(value); |
| 358 | if (a) { |
| 359 | return new Date(Date.UTC(+a[1], +a[2] - 1, +a[3], +a[4], |
| 360 | +a[5], +a[6])); |
| 361 | } |
| 362 | } |
| 363 | return value; |
| 364 | }); |
| 365 | |
| 366 | myData = JSON.parse('["Date(09/09/2001)"]', function (key, value) { |
| 367 | var d; |
| 368 | if (typeof value === 'string' && |
| 369 | value.slice(0, 5) === 'Date(' && |
| 370 | value.slice(-1) === ')') { |
| 371 | d = new Date(value.slice(5, -1)); |
| 372 | if (d) { |
| 373 | return d; |
| 374 | } |
| 375 | } |
| 376 | return value; |
| 377 | }); |
| 378 | |
| 379 | |
| 380 | This is a reference implementation. You are free to copy, modify, or |
| 381 | redistribute. |
| 382 | */ |
| 383 | |
| 384 | /*jslint evil: true, strict: false, regexp: false */ |
| 385 | |
| 386 | /*members "", "\b", "\t", "\n", "\f", "\r", "\"", JSON, "\\", apply, |
| 387 | call, charCodeAt, getUTCDate, getUTCFullYear, getUTCHours, |
| 388 | getUTCMinutes, getUTCMonth, getUTCSeconds, hasOwnProperty, join, |
| 389 | lastIndex, length, parse, prototype, push, replace, slice, stringify, |
| 390 | test, toJSON, toString, valueOf |
| 391 | */ |
| 392 | |
| 393 | |
| 394 | // Create a JSON object only if one does not already exist. We create the |
| 395 | // methods in a closure to avoid creating global variables. |
| 396 | |
| 397 | var JSON; |
| 398 | if (!JSON) { |
| 399 | JSON = {}; |
| 400 | } |
| 401 | |
| 402 | (function () { |
| 403 | "use strict"; |
| 404 | |
| 405 | function f(n) { |
| 406 | // Format integers to have at least two digits. |
| 407 | return n < 10 ? '0' + n : n; |
| 408 | } |
| 409 | |
| 410 | if (typeof Date.prototype.toJSON !== 'function') { |
| 411 | |
| 412 | Date.prototype.toJSON = function (key) { |
| 413 | |
| 414 | return isFinite(this.valueOf()) ? |
| 415 | this.getUTCFullYear() + '-' + |
| 416 | f(this.getUTCMonth() + 1) + '-' + |
| 417 | f(this.getUTCDate()) + 'T' + |
| 418 | f(this.getUTCHours()) + ':' + |
| 419 | f(this.getUTCMinutes()) + ':' + |
| 420 | f(this.getUTCSeconds()) + 'Z' : null; |
| 421 | }; |
| 422 | |
| 423 | String.prototype.toJSON = |
| 424 | Number.prototype.toJSON = |
| 425 | Boolean.prototype.toJSON = function (key) { |
| 426 | return this.valueOf(); |
| 427 | }; |
| 428 | } |
| 429 | |
| 430 | var cx = /[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g, |
| 431 | escapable = /[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g, |
| 432 | gap, |
| 433 | indent, |
| 434 | meta = { // table of character substitutions |
| 435 | '\b': '\\b', |
| 436 | '\t': '\\t', |
| 437 | '\n': '\\n', |
| 438 | '\f': '\\f', |
| 439 | '\r': '\\r', |
| 440 | '"' : '\\"', |
| 441 | '\\': '\\\\' |
| 442 | }, |
| 443 | rep; |
| 444 | |
| 445 | |
| 446 | function quote(string) { |
| 447 | |
| 448 | // If the string contains no control characters, no quote characters, and no |
| 449 | // backslash characters, then we can safely slap some quotes around it. |
| 450 | // Otherwise we must also replace the offending characters with safe escape |
| 451 | // sequences. |
| 452 | |
| 453 | escapable.lastIndex = 0; |
| 454 | return escapable.test(string) ? '"' + string.replace(escapable, function (a) { |
| 455 | var c = meta[a]; |
| 456 | return typeof c === 'string' ? c : |
| 457 | '\\u' + ('0000' + a.charCodeAt(0).toString(16)).slice(-4); |
| 458 | }) + '"' : '"' + string + '"'; |
| 459 | } |
| 460 | |
| 461 | |
| 462 | function str(key, holder) { |
| 463 | |
| 464 | // Produce a string from holder[key]. |
| 465 | |
| 466 | var i, // The loop counter. |
| 467 | k, // The member key. |
| 468 | v, // The member value. |
| 469 | length, |
| 470 | mind = gap, |
| 471 | partial, |
| 472 | value = holder[key]; |
| 473 | |
| 474 | // If the value has a toJSON method, call it to obtain a replacement value. |
| 475 | |
| 476 | if (value && typeof value === 'object' && |
| 477 | typeof value.toJSON === 'function') { |
| 478 | value = value.toJSON(key); |
| 479 | } |
| 480 | |
| 481 | // If we were called with a replacer function, then call the replacer to |
| 482 | // obtain a replacement value. |
| 483 | |
| 484 | if (typeof rep === 'function') { |
| 485 | value = rep.call(holder, key, value); |
| 486 | } |
| 487 | |
| 488 | // What happens next depends on the value's type. |
| 489 | |
| 490 | switch (typeof value) { |
| 491 | case 'string': |
| 492 | return quote(value); |
| 493 | |
| 494 | case 'number': |
| 495 | |
| 496 | // JSON numbers must be finite. Encode non-finite numbers as null. |
| 497 | |
| 498 | return isFinite(value) ? String(value) : 'null'; |
| 499 | |
| 500 | case 'boolean': |
| 501 | case 'null': |
| 502 | |
| 503 | // If the value is a boolean or null, convert it to a string. Note: |
| 504 | // typeof null does not produce 'null'. The case is included here in |
| 505 | // the remote chance that this gets fixed someday. |
| 506 | |
| 507 | return String(value); |
| 508 | |
| 509 | // If the type is 'object', we might be dealing with an object or an array or |
| 510 | // null. |
| 511 | |
| 512 | case 'object': |
| 513 | |
| 514 | // Due to a specification blunder in ECMAScript, typeof null is 'object', |
| 515 | // so watch out for that case. |
| 516 | |
| 517 | if (!value) { |
| 518 | return 'null'; |
| 519 | } |
| 520 | |
| 521 | // Make an array to hold the partial results of stringifying this object value. |
| 522 | |
| 523 | gap += indent; |
| 524 | partial = []; |
| 525 | |
| 526 | // Is the value an array? |
| 527 | |
| 528 | if (Object.prototype.toString.apply(value) === '[object Array]') { |
| 529 | |
| 530 | // The value is an array. Stringify every element. Use null as a placeholder |
| 531 | // for non-JSON values. |
| 532 | |
| 533 | length = value.length; |
| 534 | for (i = 0; i < length; i += 1) { |
| 535 | partial[i] = str(i, value) || 'null'; |
| 536 | } |
| 537 | |
| 538 | // Join all of the elements together, separated with commas, and wrap them in |
| 539 | // brackets. |
| 540 | |
| 541 | v = partial.length === 0 ? '[]' : gap ? |
| 542 | '[\n' + gap + partial.join(',\n' + gap) + '\n' + mind + ']' : |
| 543 | '[' + partial.join(',') + ']'; |
| 544 | gap = mind; |
| 545 | return v; |
| 546 | } |
| 547 | |
| 548 | // If the replacer is an array, use it to select the members to be stringified. |
| 549 | |
| 550 | if (rep && typeof rep === 'object') { |
| 551 | length = rep.length; |
| 552 | for (i = 0; i < length; i += 1) { |
| 553 | if (typeof rep[i] === 'string') { |
| 554 | k = rep[i]; |
| 555 | v = str(k, value); |
| 556 | if (v) { |
| 557 | partial.push(quote(k) + (gap ? ': ' : ':') + v); |
| 558 | } |
| 559 | } |
| 560 | } |
| 561 | } else { |
| 562 | |
| 563 | // Otherwise, iterate through all of the keys in the object. |
| 564 | |
| 565 | for (k in value) { |
| 566 | if (Object.prototype.hasOwnProperty.call(value, k)) { |
| 567 | v = str(k, value); |
| 568 | if (v) { |
| 569 | partial.push(quote(k) + (gap ? ': ' : ':') + v); |
| 570 | } |
| 571 | } |
| 572 | } |
| 573 | } |
| 574 | |
| 575 | // Join all of the member texts together, separated with commas, |
| 576 | // and wrap them in braces. |
| 577 | |
| 578 | v = partial.length === 0 ? '{}' : gap ? |
| 579 | '{\n' + gap + partial.join(',\n' + gap) + '\n' + mind + '}' : |
| 580 | '{' + partial.join(',') + '}'; |
| 581 | gap = mind; |
| 582 | return v; |
| 583 | } |
| 584 | } |
| 585 | |
| 586 | // If the JSON object does not yet have a stringify method, give it one. |
| 587 | |
| 588 | if (typeof JSON.stringify !== 'function') { |
| 589 | JSON.stringify = function (value, replacer, space) { |
| 590 | |
| 591 | // The stringify method takes a value and an optional replacer, and an optional |
| 592 | // space parameter, and returns a JSON text. The replacer can be a function |
| 593 | // that can replace values, or an array of strings that will select the keys. |
| 594 | // A default replacer method can be provided. Use of the space parameter can |
| 595 | // produce text that is more easily readable. |
| 596 | |
| 597 | var i; |
| 598 | gap = ''; |
| 599 | indent = ''; |
| 600 | |
| 601 | // If the space parameter is a number, make an indent string containing that |
| 602 | // many spaces. |
| 603 | |
| 604 | if (typeof space === 'number') { |
| 605 | for (i = 0; i < space; i += 1) { |
| 606 | indent += ' '; |
| 607 | } |
| 608 | |
| 609 | // If the space parameter is a string, it will be used as the indent string. |
| 610 | |
| 611 | } else if (typeof space === 'string') { |
| 612 | indent = space; |
| 613 | } |
| 614 | |
| 615 | // If there is a replacer, it must be a function or an array. |
| 616 | // Otherwise, throw an error. |
| 617 | |
| 618 | rep = replacer; |
| 619 | if (replacer && typeof replacer !== 'function' && |
| 620 | (typeof replacer !== 'object' || |
| 621 | typeof replacer.length !== 'number')) { |
| 622 | throw new Error('JSON.stringify'); |
| 623 | } |
| 624 | |
| 625 | // Make a fake root object containing our value under the key of ''. |
| 626 | // Return the result of stringifying the value. |
| 627 | |
| 628 | return str('', {'': value}); |
| 629 | }; |
| 630 | } |
| 631 | |
| 632 | |
| 633 | // If the JSON object does not yet have a parse method, give it one. |
| 634 | |
| 635 | if (typeof JSON.parse !== 'function') { |
| 636 | JSON.parse = function (text, reviver) { |
| 637 | |
| 638 | // The parse method takes a text and an optional reviver function, and returns |
| 639 | // a JavaScript value if the text is a valid JSON text. |
| 640 | |
| 641 | var j; |
| 642 | |
| 643 | function walk(holder, key) { |
| 644 | |
| 645 | // The walk method is used to recursively walk the resulting structure so |
| 646 | // that modifications can be made. |
| 647 | |
| 648 | var k, v, value = holder[key]; |
| 649 | if (value && typeof value === 'object') { |
| 650 | for (k in value) { |
| 651 | if (Object.prototype.hasOwnProperty.call(value, k)) { |
| 652 | v = walk(value, k); |
| 653 | if (v !== undefined) { |
| 654 | value[k] = v; |
| 655 | } else { |
| 656 | delete value[k]; |
| 657 | } |
| 658 | } |
| 659 | } |
| 660 | } |
| 661 | return reviver.call(holder, key, value); |
| 662 | } |
| 663 | |
| 664 | |
| 665 | // Parsing happens in four stages. In the first stage, we replace certain |
| 666 | // Unicode characters with escape sequences. JavaScript handles many characters |
| 667 | // incorrectly, either silently deleting them, or treating them as line endings. |
| 668 | |
| 669 | text = String(text); |
| 670 | cx.lastIndex = 0; |
| 671 | if (cx.test(text)) { |
| 672 | text = text.replace(cx, function (a) { |
| 673 | return '\\u' + |
| 674 | ('0000' + a.charCodeAt(0).toString(16)).slice(-4); |
| 675 | }); |
| 676 | } |
| 677 | |
| 678 | // In the second stage, we run the text against regular expressions that look |
| 679 | // for non-JSON patterns. We are especially concerned with '()' and 'new' |
| 680 | // because they can cause invocation, and '=' because it can cause mutation. |
| 681 | // But just to be safe, we want to reject all unexpected forms. |
| 682 | |
| 683 | // We split the second stage into 4 regexp operations in order to work around |
| 684 | // crippling inefficiencies in IE's and Safari's regexp engines. First we |
| 685 | // replace the JSON backslash pairs with '@' (a non-JSON character). Second, we |
| 686 | // replace all simple value tokens with ']' characters. Third, we delete all |
| 687 | // open brackets that follow a colon or comma or that begin the text. Finally, |
| 688 | // we look to see that the remaining characters are only whitespace or ']' or |
| 689 | // ',' or ':' or '{' or '}'. If that is so, then the text is safe for eval. |
| 690 | |
| 691 | if (/^[\],:{}\s]*$/ |
| 692 | .test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, '@') |
| 693 | .replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, ']') |
| 694 | .replace(/(?:^|:|,)(?:\s*\[)+/g, ''))) { |
| 695 | |
| 696 | // In the third stage we use the eval function to compile the text into a |
| 697 | // JavaScript structure. The '{' operator is subject to a syntactic ambiguity |
| 698 | // in JavaScript: it can begin a block or an object literal. We wrap the text |
| 699 | // in parens to eliminate the ambiguity. |
| 700 | |
| 701 | j = eval('(' + text + ')'); |
| 702 | |
| 703 | // In the optional fourth stage, we recursively walk the new structure, passing |
| 704 | // each name/value pair to a reviver function for possible transformation. |
| 705 | |
| 706 | return typeof reviver === 'function' ? |
| 707 | walk({'': j}, '') : j; |
| 708 | } |
| 709 | |
| 710 | // If the text is not JSON parseable, then a SyntaxError is thrown. |
| 711 | |
| 712 | throw new SyntaxError('JSON.parse'); |
| 713 | }; |
| 714 | } |
| 715 | }()); |
| 716 | |
| 717 | |
| 718 | // load all critical libraries |
| 719 | wn.require("lib/js/lib/jquery.min.js"); |
| 720 | //wn.require("js/lib/history/history.min.js"); |
| 721 | wn.require("lib/js/lib/history/history.adapter.jquery.js"); |
| 722 | wn.require("lib/js/lib/history/history.js"); |
| 723 | wn.require("lib/js/lib/history/history.html4.js"); |
| 724 | wn.require("lib/js/wn/history.js"); |
| 725 | |
| 726 | /* overload links for ajax pages */ |
| 727 | $(document).bind('ready', function() { |
| 728 | var base = window.location.href.split('#')[0]; |
| 729 | |
| 730 | // convert hard links to softlinks |
| 731 | $.each($('a[softlink!="false"]'), function(i, v) { |
| 732 | |
| 733 | // if linking on the same site |
| 734 | if(v.href.substr(0, base.length)==base) { |
| 735 | var path = (v.href.substr(base.length)); |
| 736 | |
| 737 | // if hardlink, softlink it |
| 738 | if(path.substr(0,1)!='#') { |
| 739 | v.href = base + '#' + path; |
| 740 | } |
| 741 | } |
| 742 | }); |
| 743 | |
| 744 | // go to hash page if exists |
| 745 | if(window.location.hash) { |
| 746 | wn.page.set(window.location.hash.substr(1)); |
| 747 | } |
| 748 | |
| 749 | }); |
| 750 | wn.require("js/app.js"); |
| 751 | </script> |
| 752 | </head> |
| 753 | <body> |
| 754 | <div id="dialog_back"></div> |
| 755 | |
| 756 | <div id="startup_div" style="padding: 8px; font-size: 14px;"></div> |
| 757 | |
| 758 | <!-- Main Starts --> |
| 759 | <div id="body_div"> |
| 760 | |
| 761 | <!--static (no script) content--> |
| 762 | <div class="no_script"> |
| 763 | |
| 764 | </div> |
| 765 | |
| 766 | </div> |
| 767 | </body> |