Skip to content
This repository has been archived by the owner on Nov 3, 2021. It is now read-only.

Commit

Permalink
Merge pull request #17240 from sprd-ffos/v1.3t
Browse files Browse the repository at this point in the history
Bug 809031 - OOP <iframe> content disappear if placed below 147px inside...
  • Loading branch information
sprd-ffos committed Mar 18, 2014
2 parents 2973a7d + d79dd6f commit 8ee9719
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 22 deletions.
25 changes: 7 additions & 18 deletions apps/system/js/cost_control.js
Expand Up @@ -4,6 +4,7 @@
(function() {

'use strict';
/* global Applications, asyncStorage */

var host = document.location.host;
var domain = host.replace(/(^[\w\d]+\.)?([\w\d]+\.[a-z]+)/, '$2');
Expand All @@ -14,16 +15,19 @@

var widgetFrame;
function _ensureWidget() {
if (!Applications.ready)
if (!Applications.ready) {
return;
}

if (!Applications.getByManifestURL(origin + '/manifest.webapp'))
if (!Applications.getByManifestURL(origin + '/manifest.webapp')) {
return;
}

// Check widget is there
widgetFrame = widgetContainer.querySelector('iframe');
if (widgetFrame)
if (widgetFrame) {
return;
}

// Create the widget
if (!widgetFrame) {
Expand All @@ -43,7 +47,6 @@
widgetContainer.appendChild(widgetFrame);

_attachNetworkEvents();
_adjustWidgetPosition();
}

function _onError(e) {
Expand Down Expand Up @@ -92,18 +95,6 @@
}
}

function _adjustWidgetPosition() {
if (!widgetFrame)
return;

// TODO: Remove this when weird bug #809031 (Bugzilla) is solved
// See cost_control.css as well to remove the last rule
var offsetY = document.getElementById('notification-bar').clientHeight;
offsetY +=
document.getElementById('notifications-container').clientHeight;
widgetFrame.style.transform = 'translate(0, ' + offsetY + 'px)';
}

// Listen to utilitytray show
window.addEventListener('utilitytrayshow', _showWidget);
window.addEventListener('utilitytrayhide', _hideWidget);
Expand All @@ -122,6 +113,4 @@
}
});
});

window.addEventListener('resize', _adjustWidgetPosition);
}());
4 changes: 0 additions & 4 deletions apps/system/style/cost_control/cost_control.css
Expand Up @@ -8,7 +8,3 @@
padding: 0;
}

#cost-control-widget iframe {
position: absolute;
top: 0;
}

0 comments on commit 8ee9719

Please sign in to comment.