browserWindow.js 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618
  1. /*******************************************************************************
  2. * Copyright (c) 2008, 2013 IBM Corporation and others.
  3. * All rights reserved. This program and the accompanying materials
  4. * are made available under the terms of the Eclipse Public License v1.0
  5. * which accompanies this distribution, and is available at
  6. * http://www.eclipse.org/legal/epl-v10.html
  7. *
  8. * Contributors:
  9. * IBM Corporation - initial API and implementation
  10. *******************************************************************************/
  11. function BarProp(){};
  12. BarProp.prototype = new Array();
  13. /**
  14. * Object Window()
  15. * @super Global
  16. * @constructor
  17. * @since Common Usage, no standard
  18. */
  19. function Window(){};
  20. Window.prototype = new EventTarget();
  21. Window.prototype.self = new Window();
  22. Window.prototype.window = new Window();
  23. Window.prototype.frames = new Array();
  24. /**
  25. * Property closed
  26. * @type Boolean
  27. * @memberOf Window
  28. */
  29. Window.prototype.closed = new Boolean();
  30. /**
  31. * Property defaultStatus
  32. * @type String
  33. * @memberOf Window
  34. */
  35. Window.prototype.defaultStatus = "";
  36. /**
  37. * Property document
  38. * @type Document
  39. * @memberOf Window
  40. */
  41. Window.prototype.document= new HTMLDocument();
  42. /**
  43. * Property history
  44. * @type History
  45. * @memberOf Window
  46. */
  47. Window.prototype.history= new History();
  48. /**
  49. * Property location
  50. * @type Location
  51. * @memberOf Window
  52. */
  53. Window.prototype.location=new Location();
  54. /**
  55. * Property name
  56. * @type String
  57. * @memberOf Window
  58. */
  59. Window.prototype.name = "";
  60. /**
  61. * Property navigator
  62. * @type Navigator
  63. * @memberOf Window
  64. */
  65. Window.prototype.navigator = new Navigator();
  66. /**
  67. * Property opener
  68. * @type Window
  69. * @memberOf Window
  70. */
  71. Window.prototype.opener = new Window();
  72. /**
  73. * Property outerWidth
  74. * @type Number
  75. * @memberOf Window
  76. */
  77. Window.prototype.outerWidth = 0;
  78. /**
  79. * Property outerHeight
  80. * @type Number
  81. * @memberOf Window
  82. */
  83. Window.prototype.outerHeight = 0;
  84. /**
  85. * Property pageXOffset
  86. * @type Number
  87. * @memberOf Window
  88. */
  89. Window.prototype.pageXOffset = 0;
  90. /**
  91. * Property pageYOffset
  92. * @type Number
  93. * @memberOf Window
  94. */
  95. Window.prototype.pageYOffset = 0;
  96. /**
  97. * Property parent
  98. * @type Window
  99. * @memberOf Window
  100. */
  101. Window.prototype.parent = new Window();
  102. /**
  103. * Property screen
  104. * @type Screen
  105. * @memberOf Window
  106. */
  107. Window.prototype.screen = new Screen();
  108. /**
  109. * Property status
  110. * @type String
  111. * @memberOf Window
  112. */
  113. Window.prototype.status = "";
  114. /**
  115. * Property top
  116. * @type Window
  117. * @memberOf Window
  118. */
  119. Window.prototype.top = new Window();
  120. /*
  121. * These properties may need to be moved into a browswer specific library.
  122. */
  123. /**
  124. * Property innerWidth
  125. * @type Number
  126. * @memberOf Window
  127. */
  128. Window.prototype.innerWidth = 0;
  129. /**
  130. * Property innerHeight
  131. * @type Number
  132. * @memberOf Window
  133. */
  134. Window.prototype.innerHeight = 0;
  135. /**
  136. * Property screenX
  137. * @type Number
  138. * @memberOf Window
  139. */
  140. Window.prototype.screenX = 0;
  141. /**
  142. * Property screenY
  143. * @type Number
  144. * @memberOf Window
  145. */
  146. Window.prototype.screenY = 0;
  147. /**
  148. * Property screenLeft
  149. * @type Number
  150. * @memberOf Window
  151. */
  152. Window.prototype.screenLeft = 0;
  153. /**
  154. * Property screenTop
  155. * @type Number
  156. * @memberOf Window
  157. */
  158. Window.prototype.screenTop = 0;
  159. //Window.prototype.event = new Event();
  160. Window.prototype.length = 0;
  161. Window.prototype.scrollbars= new BarProp();
  162. Window.prototype.scrollX=0;
  163. Window.prototype.scrollY=0;
  164. Window.prototype.content= new Window();
  165. Window.prototype.menubar= new BarProp();
  166. Window.prototype.toolbar= new BarProp();
  167. Window.prototype.locationbar= new BarProp();
  168. Window.prototype.personalbar= new BarProp();
  169. Window.prototype.statusbar= new BarProp();
  170. Window.prototype.directories= new BarProp();
  171. Window.prototype.scrollMaxX=0;
  172. Window.prototype.scrollMaxY=0;
  173. Window.prototype.fullScreen="";
  174. Window.prototype.frameElement="";
  175. /* End properites */
  176. /**
  177. * function alert()
  178. * @param {String} message
  179. * @memberOf Window
  180. */
  181. Window.prototype.alert = function(message){};
  182. /**
  183. * function blur()
  184. * @memberOf Window
  185. */
  186. Window.prototype.blur = function(){};
  187. /**
  188. * function clearInterval(intervalID)
  189. * @param intervalID
  190. * @memberOf Window
  191. */
  192. Window.prototype.clearInterval = function(intervalID){};
  193. /**
  194. * function clearTimeout(intervalID)
  195. * @param intervalID
  196. * @memberOf Window
  197. */
  198. Window.prototype.clearTimeout = function(intervalID){};
  199. /**
  200. * function close()
  201. * @memberOf Window
  202. */
  203. Window.prototype.close = function(){};
  204. /**
  205. * function confirm()
  206. * @param {String} arg
  207. * @memberOf Window
  208. * @returns {Boolean}
  209. */
  210. Window.prototype.confirm = function(arg){return false;};
  211. /**
  212. * function focus()
  213. * @memberOf Window
  214. */
  215. Window.prototype.focus = function(){};
  216. /**
  217. * function getComputedStyle(element, pseudoElt )
  218. * @param {Element} element
  219. * @param {String} pseudoElt
  220. * @memberOf Window
  221. * @returns {Object}
  222. */
  223. Window.prototype.getComputedStyle = function(element,pseudoElt ){return new Object();};
  224. /**
  225. * function moveTo(x, y)
  226. * @param {Number} x
  227. * @param {Number} y
  228. * @memberOf Window
  229. */
  230. Window.prototype.moveTo = function(x,y){};
  231. /**
  232. * function moveBy(deltaX, deltaY)
  233. * @param {Number} deltaX
  234. * @param {Number} deltaY
  235. * @memberOf Window
  236. */
  237. Window.prototype.moveBy = function(deltaX,deltaY){};
  238. /**
  239. * function open(optionalArg1, optionalArg2, optionalArg3, optionalArg4)
  240. * @param {String} url
  241. * @param {String} windowName
  242. * @param {String} windowFeatures
  243. * @param {Boolean} optionalArg4
  244. * @memberOf Window
  245. * @returns {Window}
  246. */
  247. Window.prototype.open = function(url, windowName, windowFeatures, optionalArg4){return new Window();};
  248. /**
  249. * function print()
  250. * @memberOf Window
  251. */
  252. Window.prototype.print = function(){};
  253. /**
  254. * function prompt(text, value)
  255. * @param {String} text
  256. * @param {String} value
  257. * @memberOf Window
  258. * @returns {String}
  259. */
  260. Window.prototype.prompt = function(text, value){return "";};
  261. /**
  262. * function resizeTo(newOuterWidth,newOuterHeight)
  263. * @param {Number} newOuterWidth
  264. * @param {Number} newOuterHeighr
  265. * @memberOf Window
  266. */
  267. Window.prototype.resizeTo=function(newOuterWidth,newOuterHeight){};
  268. /**
  269. * function resizeBy(deltaX, deltaY)
  270. * @param {Number} deltaX
  271. * @param {Number} deltaY
  272. * @memberOf Window
  273. */
  274. Window.prototype.resizeBy=function(deltaX,deltaY){};
  275. /**
  276. * function scrollTo(x,y)
  277. * @param {Number} x
  278. * @param {Number} y
  279. * @memberOf Window
  280. */
  281. Window.prototype.scrollTo=function(x,y){};
  282. /**
  283. * function scrollBy(pixelX,pixelY)
  284. * @param {Number} pixelX
  285. * @param {Number} pixelY
  286. * @memberOf Window
  287. */
  288. Window.prototype.scrollBy=function(pixelX,pixelY){};
  289. /**
  290. * function setInterval(arg1, arg2)
  291. * @param {Function} callback
  292. * @param {Number} delay
  293. * @memberOf Window
  294. * @returns {Number}
  295. */
  296. Window.prototype.setInterval=function(callback, delay){return 0;};
  297. /**
  298. * function setTimeout(callback, delay)
  299. * @param {Function} callback
  300. * @param {Number} delay
  301. * @memberOf Window
  302. * @returns {Number}
  303. */
  304. Window.prototype.setTimeout=function(callback, delay){ return 0;};
  305. /**
  306. * function atob(encodedData)
  307. * @param {String} encodedData
  308. * @memberOf Window
  309. * @returns {String}
  310. */
  311. Window.prototype.atob=function(encodedData){return "";};
  312. /**
  313. * function btoa(arg)
  314. * @param {String} stringToEncode
  315. * @memberOf Window
  316. * @returns {String}
  317. */
  318. Window.prototype.btoa=function(stringToEncode){return "";};
  319. /**
  320. * function setResizable(resizable)
  321. * @param {Boolean} resizable
  322. * @memberOf Window
  323. */
  324. Window.prototype.setResizable=function(resizable){};
  325. Window.prototype.captureEvents=function(eventType){};
  326. Window.prototype.releaseEvents=function(eventType){};
  327. Window.prototype.routeEvent=function(eventType){};
  328. Window.prototype.enableExternalCapture=function(){};
  329. Window.prototype.disableExternalCapture=function(){};
  330. Window.prototype.find=function(){};
  331. Window.prototype.back=function(){};
  332. Window.prototype.forward=function(){};
  333. Window.prototype.home=function(){};
  334. Window.prototype.stop=function(){};
  335. /**
  336. * @param {Number} pixelX
  337. * @param {Number} pixelY
  338. */
  339. Window.prototype.scroll=function(pixelX,pixelY){};
  340. /* End functions */
  341. /**
  342. * Object History()
  343. * @super Object
  344. * @constructor
  345. * @since Common Usage, no standard
  346. */
  347. function History(){};
  348. History.prototype=new Object();
  349. History.prototype.history = new History();
  350. /**
  351. * Property length
  352. * @type Number
  353. * @memberOf History
  354. */
  355. History.prototype.length = 0;
  356. /**
  357. * function back()
  358. * @memberOf History
  359. */
  360. History.prototype.back = function(){};
  361. /**
  362. * function forward()
  363. * @memberOf History
  364. */
  365. History.prototype.forward = function(){};
  366. /**
  367. * function back()
  368. * @param arg
  369. * @memberOf History
  370. */
  371. History.prototype.go = function(arg){};
  372. /**
  373. * Object Location()
  374. * @super Object
  375. * @constructor
  376. * @since Common Usage, no standard
  377. */
  378. function Location(){};
  379. Location.prototype = new Object();
  380. Location.prototype.location = new Location();
  381. /**
  382. * Property hash
  383. * @type String
  384. * @memberOf Location
  385. */
  386. Location.prototype.hash = "";
  387. /**
  388. * Property host
  389. * @type String
  390. * @memberOf Location
  391. */
  392. Location.prototype.host = "";
  393. /**
  394. * Property hostname
  395. * @type String
  396. * @memberOf Location
  397. */
  398. Location.prototype.hostname = "";
  399. /**
  400. * Property href
  401. * @type String
  402. * @memberOf Location
  403. */
  404. Location.prototype.href = "";
  405. /**
  406. * Property pathname
  407. * @type String
  408. * @memberOf Location
  409. */
  410. Location.prototype.pathname = "";
  411. /**
  412. * Property port
  413. * @type String
  414. * @memberOf Location
  415. */
  416. Location.prototype.port = "";
  417. /**
  418. * Property protocol
  419. * @type String
  420. * @memberOf Location
  421. */
  422. Location.prototype.protocol = "";
  423. /**
  424. * Property search
  425. * @type String
  426. * @memberOf Location
  427. */
  428. Location.prototype.search = "";
  429. /**
  430. * function assign(arg)
  431. * @param {String} arg
  432. * @memberOf Location
  433. */
  434. Location.prototype.assign = function(arg){};
  435. /**
  436. * function reload(optionalArg)
  437. * @param {Boolean} optionalArg
  438. * @memberOf Location
  439. */
  440. Location.prototype.reload = function(optionalArg){};
  441. /**
  442. * function replace(arg)
  443. * @param {String} arg
  444. * @memberOf Location
  445. */
  446. Location.prototype.replace = function(arg){};
  447. /**
  448. * Object Navigator()
  449. * @super Object
  450. * @constructor
  451. * @since Common Usage, no standard
  452. */
  453. function Navigator(){};
  454. Navigator.prototype = new Object();
  455. Navigator.prototype.navigator = new Navigator();
  456. /**
  457. * Property appCodeName
  458. * @type String
  459. * @memberOf Navigator
  460. */
  461. Navigator.prototype.appCodeName = "";
  462. /**
  463. * Property appName
  464. * @type String
  465. * @memberOf Navigator
  466. */
  467. Navigator.prototype.appName = "";
  468. /**
  469. * Property appVersion
  470. * @type String
  471. * @memberOf Navigator
  472. */
  473. Navigator.prototype.appVersion = "";
  474. /**
  475. * Property cookieEnabled
  476. * @type Boolean
  477. * @memberOf Navigator
  478. */
  479. Navigator.prototype.cookieEnabled = new Boolean();
  480. /**
  481. * Property mimeTypes
  482. * @type Array
  483. * @memberOf Navigator
  484. */
  485. Navigator.prototype.mimeTypes = new Array();
  486. /**
  487. * Property platform
  488. * @type String
  489. * @memberOf Navigator
  490. */
  491. Navigator.prototype.platform = "";
  492. /**
  493. * Property plugins
  494. * @type Array
  495. * @memberOf Navigator
  496. */
  497. Navigator.prototype.plugins = new Array();
  498. /**
  499. * Property userAgent
  500. * @type String
  501. * @memberOf Navigator
  502. */
  503. Navigator.prototype.userAgent = "";
  504. /**
  505. * function javaEnabled()
  506. * @returns {Boolean}
  507. * @memberOf Navigator
  508. */
  509. Navigator.prototype.javaEnabled = function(){return false;};
  510. /**
  511. * Object Screen()
  512. * @super Object
  513. * @constructor
  514. * @since Common Usage, no standard
  515. */
  516. function Screen(){};
  517. Screen.prototype = new Object();
  518. Screen.prototype.screen = new Screen();
  519. /**
  520. * Property availHeight
  521. * @type Number
  522. * @memberOf Screen
  523. */
  524. Navigator.prototype.availHeight = 0;
  525. /**
  526. * Property availWidth
  527. * @type Number
  528. * @memberOf Screen
  529. */
  530. Navigator.prototype.availWidth = 0;
  531. /**
  532. * Property colorDepth
  533. * @type Number
  534. * @memberOf Screen
  535. */
  536. Navigator.prototype.colorDepth = 0;
  537. /**
  538. * Property height
  539. * @type Number
  540. * @memberOf Screen
  541. */
  542. Navigator.prototype.height = 0;
  543. /**
  544. * Property width
  545. * @type Number
  546. * @memberOf Screen
  547. */
  548. Navigator.prototype.width = 0;
  549. Event.prototype=new Object();
  550. // PhaseType
  551. Event.prototype.CAPTURING_PHASE = 1;
  552. Event.prototype.AT_TARGET = 2;
  553. Event.prototype.BUBBLING_PHASE = 3;
  554. Event.prototype.type="";
  555. Event.prototype.target=new EventTarget();
  556. Event.prototype.currentTarget=new EventTarget();
  557. Event.prototype.eventPhase=0;
  558. Event.prototype.bubbles=false;
  559. Event.prototype.cancelable=false;
  560. Event.prototype.timeStamp=0;
  561. Event.prototype.stopPropagation=function(){};
  562. Event.prototype.preventDefault=function(){};
  563. /**
  564. * @param {String} eventTypeArg
  565. * @param {Boolean} canBubbleArg
  566. * @param {Boolean} cancelableArg
  567. */
  568. Event.prototype.initEvent=function(eventTypeArg,
  569. canBubbleArg,
  570. cancelableArg){};
  571. function EventListener(){};
  572. EventListener.prototype=new Object();
  573. /**
  574. * @param {Event} event
  575. * @memberOf EventListener
  576. */
  577. EventListener.prototype.handleEvent=function(event){};
  578. function EventTarget(){};
  579. EventTarget.prototype=new Object();
  580. /*
  581. * These functions may need to be moved into a browser specific library.
  582. */
  583. /**
  584. * @memberOf Window
  585. * @param event {Event}
  586. * @throws {EventException}
  587. */
  588. EventTarget.prototype.dispatchEvent=function(event){};
  589. // https://developer.mozilla.org/en-US/docs/DOM/element.addEventListener
  590. /**
  591. * @memberOf Window
  592. * @param {String} type
  593. * @param {EventListener} listener
  594. * @param {Boolean} useCapture
  595. */
  596. EventTarget.prototype.addEventListener=function(type, listener, useCapture){};
  597. // https://developer.mozilla.org/en-US/docs/DOM/element.removeEventListener
  598. /**
  599. * @memberOf Window
  600. * @param {String} type
  601. * @param {EventListener} listener
  602. * @param {Boolean} useCapture
  603. */
  604. EventTarget.prototype.removeEventListener=function(type, listener, useCapture){};