Skip to content

Commit

Permalink
Merge pull request #14 from dahabi/master
Browse files Browse the repository at this point in the history
Fix HTML5 Version
  • Loading branch information
abuturla authored Nov 22, 2017
2 parents 69861a3 + 9002330 commit e69d147
Showing 1 changed file with 32 additions and 7 deletions.
39 changes: 32 additions & 7 deletions widget/index.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!DOCTYPE html>
<html>
<html ng-app="opentablePlugin">
<head lang="en">
<meta charset="UTF-8">
<title>widget</title>
Expand Down Expand Up @@ -30,19 +30,42 @@
}
</style>
</head>
<body>
<div class="text-center link-verified">
<div class="col-md-12">
<span class="glyphicon glyphicon-ok" aria-hidden="true"></span>
<body class="no-scroll" ng-controller="opentablePluginCtrl" ng-cloak>
<div class="scrollable" ng-if="isLiveMode" >
<p ng-if="loading" class="bodyTextTheme backgroundColorTheme" style="position: absolute; top: 0; padding:8px 0; display: inline-block; width: 100%; left: 0; background: #eef0f0; text-align: center; color: #5f5f5f;">Loading...</p>
<iframe ng-src="{{url}}" style="height:100%; width:1px; min-width:100%;" scrolling="{{isIOS ? 'no' : 'auto'}}" iframe-onload="iframeLoadedCallBack()" id="webviewIframe"></iframe>
</div>
<div style="text-align: center;vertical-align: middle; height: 100%" ng-if="!isLiveMode">
<div style="margin-top: 50%;">

<p>
We were able to verify the link you provided. The link will only appear on your mobile device.
</p>
</div>
</div>

<script>
buildfire.spinner.show();
var opentablePluginApp = angular.module('opentablePlugin', []);

opentablePluginApp.directive("iframeOnload", [function () {
return {
scope: {
callBack: '&iframeOnload'
},
link: function (scope, element, attrs) {
element.on('load', function () {
return scope.callBack();
});
}
}
}]);
opentablePluginApp.controller('opentablePluginCtrl', ["$scope", "$sce", "$timeout", function ($scope, $sce, $timeout) {

buildfire.spinner.show();

function dataLoadedHandler(result) {
$scope.isLiveMode = buildfire.context.liveMode=="1";
$scope.$apply();
var content = null;
if (result && result.data && !angular.equals({}, result.data)) {
if (result.data.content) {
Expand All @@ -55,7 +78,8 @@
buildfire.navigation.goBack();
},200);
} else {
document.querySelector(".link-verified").style.display = "block";
$scope.url = $sce.trustAsResourceUrl(content.opentableId);
$scope.$apply();
}
});
}
Expand Down Expand Up @@ -88,6 +112,7 @@
buildfire.datastore.onUpdate(function (result) {
dataLoadedHandler(result);
});
}]);
</script>
</body>

Expand Down

0 comments on commit e69d147

Please sign in to comment.