LinkController.js
5.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
'use strict';
AIA.controller("LinkController", ["$scope", "$rootScope", "$log", "$location", "pages", "$routeParams", "$window","$interval",
function ($scope, $rootScope, log, $location, pages, $routeParams, $window,$interval) {
//$rootScope.currentActiveModuleTitle = Modules[10].Name;
//$rootScope.currentActiveModuleTitle = $routeParams.modname;
$scope.links = [
new link("encyclopedia", "Encyclopedia", 'https://ssl.adam.com/content.aspx?site=aia5se3.adam.com&login=AIA41842&productId=117', "100%", "750px"),
new link("IP-10", "IP 10", "https://interactiveanatomy.com/content/IPWeb10/index.aspx", "100%", "750px"),
new link("indepth-reports", "In-Depth Reports", "https://ssl.adam.com/content.aspx?site=aia5se3.adam.com&login=AIA41842&productId=10", "100%", "4000px"),
new link("complementary-and-alternate-medicine", "Complementary and Alternative Medicine", "https://ssl.adam.com/content.aspx?site=aia5se3.adam.com&login=AIA41842&productId=107", "100%", "750px"),
new link("bodyguide", "Body Guide", "https://ssl.adam.com/content.aspx?site=aia5se3.adam.com&login=AIA41842&productId=25 ", "100%", "1050px"),
new link("health-navigator", "Health Navigator", "https://ssl.adam.com/content.aspx?site=aia5se3.adam.com&login=AIA41842&productId=65 ", "100%", "1000px"),
new link("wellness-tools", "The Wellness Tools", "https://ssl.adam.com/content.aspx?site=aia5se3.adam.com&login=AIA41842&productId=20 ", "100%", "1500px"),
new link("aod", "A.D.A.M OnDemand", "https://adamondemand.com/Home/AIACatalog?categoriesID=2", "100%", "1500px")
];
$scope.$on('$viewContentLoaded', function (event) {
if ($rootScope.refreshcheck == null) {
$location.path('/');
}
// code that will be executed ...
// every time this view is loaded
var $uaAOD = navigator.userAgent;
for (var i = 0; i < $scope.links.length; i++) {
if ($scope.links[i].modname == $routeParams.modname) {
$rootScope.currentActiveModuleTitle = $scope.links[i].title;
if ($rootScope.currentActiveModuleTitle == "IP 10") {
// document.getElementById('externalLink').style.height = $(window).outerHeight() - 41 + "px";
$window.open($scope.links[i].objurl, '_blank');
}
else {
$scope.objdata = $scope.links[i].objurl;
$scope.myObj = $scope.links[i].objstyle;
if ($('#externalLink').css('display') === 'none') {
document.getElementById('externalLink').style.display = "block";
document.getElementById('externalLinkiframe').style.display = "none";
}
if ($rootScope.currentActiveModuleTitle == "A.D.A.M OnDemand") {
if ($uaAOD.match(/(iPod|iPhone|iPad)/i)) {
document.getElementById('externalLink').style.display = "none";
document.getElementById('externalLinkiframe').style.display = "block";
document.getElementById('externalLinkiframe').style.height = $(window).outerHeight() - 128 + "px";
document.getElementById("externalLinkiframe").src = $scope.objdata;
}
else {
document.getElementById('externalLink').style.height = $(window).outerHeight() - 128 + "px";
}
}
$scope.refreshIdleTime();
}
}
}
});
$scope.refreshIdleTime = function () {
var timeintval = null;
timeintval = $interval(PointerEventEnableDisable, 5000);
function PointerEventEnableDisable() {
var pointevents = $("#externalLink").css('pointer-events');
if (pointevents=='auto') {
$scope.stopLinkRefresh(timeintval);
timeintval = $interval(PointerEventEnableDisable, 500);
$("#externalLink").css('pointer-events', 'none');
}
else if(pointevents=='none')
{
$("#externalLink").css('pointer-events', 'auto');
$scope.stopLinkRefresh(timeintval);
timeintval = $interval(PointerEventEnableDisable, 5000);
}
else
{
//auto clode interval when panel close
$scope.stopLinkRefresh(timeintval);
}
}
$scope.stopLinkRefresh = function (timeintval) {
if (angular.isDefined(timeintval)) {
$interval.cancel(timeintval);
timeintval = undefined;
}
};
}
$scope.showTabButton = false;
$scope.IsVisible = function () {
$scope.scroll();
}
$scope.scroll = function () {
// $window.scrollTo(0, 0);
$("html,body").scrollTop(0);
//alert("scroll");
}
}]
);