diff options
Diffstat (limited to '')
-rw-r--r-- | sca-cpp/trunk/modules/js/htdocs/ui.js | 65 |
1 files changed, 16 insertions, 49 deletions
diff --git a/sca-cpp/trunk/modules/js/htdocs/ui.js b/sca-cpp/trunk/modules/js/htdocs/ui.js index b0d159d07e..b5843d8916 100644 --- a/sca-cpp/trunk/modules/js/htdocs/ui.js +++ b/sca-cpp/trunk/modules/js/htdocs/ui.js @@ -228,66 +228,33 @@ ui.queryParams = function() { qp[qs[i].substring(0, e)] = unescape(qs[i].substring(e + 1)); } return qp; -} - -/** - * Bind a widget iframe to an element. - */ -ui.widgets = {}; -ui.onload = {}; - -ui.loadwidget = function(el, doc, cb) { - var f = el + 'Frame'; - window.ui.widgets[f] = el; - window.ui.onload[f] = cb; - var div = document.createElement('div'); - div.id = f + 'Div'; - div.innerHTML = '<iframe id="' + f + '" class="widgetframe" scrolling="no" frameborder="0" src="' + doc + '" onload="window.ui.onload[this.id]()"></iframe>'; - document.body.appendChild(div); - return f; }; /** - * Show the current document body. + * Return true if the client is a mobile device. */ -ui.showbody = function() { - document.body.style.visibility = 'visible'; +ui.isMobile = function() { + var ua = navigator.userAgent; + if (ua.match(/iPhone/i) || ua.match(/iPad/i) || ua.match(/Android/i) || ua.match(/Blackberry/i) || ua.match(/WebOs/i)) + return true; + return false; }; /** - * Reload the current page. + * Initialize a document after it's loaded. */ -ui.reload = function() { - window.open(window.location, '_self'); - return true; -}; +ui.onload = function() { -/** - * Install a widget into the element bound to its iframe. - */ -ui.installwidget = function() { - if (isNil(window.parent) || isNil(window.parent.ui) || isNil(window.parent.ui.widgets)) + // Make the document visible + document.body.style.visibility = 'visible'; + + // Install orientation handler + document.body.onorientationchange = function() { + window.open(window.location, '_self'); return true; - var pdoc = ui.content(window.parent); - for (w in window.parent.ui.widgets) { - var ww = ui.elementByID(pdoc, w).contentWindow; - if (ww == window) { - document.widget = ui.elementByID(pdoc, window.parent.ui.widgets[w]); - document.widget.innerHTML = document.body.innerHTML; - return true; - } - } - return true; -}; + }; -/** - * Load an iframe into an element. - */ -ui.loadiframe = function(el, doc) { - var f = el + 'Frame'; - $(el).innerHTML = - '<iframe id="' + f + '" class="loadedframe" scrolling="no" frameborder="0" src="' + doc + '"></iframe>'; - return f; + return true; }; /** |