Commit 45541527e29b25feeded1bb53df5effb684f65d3
1 parent
add82cea
added ngstorage for using localstorage to keep the data after refreshing the page.
Showing
12 changed files
with
270 additions
and
24 deletions
400-SOURCECODE/AIAHTML5.API/AIAHTML5.API.csproj
@@ -111,7 +111,7 @@ | @@ -111,7 +111,7 @@ | ||
111 | <AutoAssignPort>True</AutoAssignPort> | 111 | <AutoAssignPort>True</AutoAssignPort> |
112 | <DevelopmentServerPort>63874</DevelopmentServerPort> | 112 | <DevelopmentServerPort>63874</DevelopmentServerPort> |
113 | <DevelopmentServerVPath>/</DevelopmentServerVPath> | 113 | <DevelopmentServerVPath>/</DevelopmentServerVPath> |
114 | - <IISUrl>http://localhost/AIA/API</IISUrl> | 114 | + <IISUrl>http://localhost/AIAHTML5/API</IISUrl> |
115 | <NTLMAuthentication>False</NTLMAuthentication> | 115 | <NTLMAuthentication>False</NTLMAuthentication> |
116 | <UseCustomServer>False</UseCustomServer> | 116 | <UseCustomServer>False</UseCustomServer> |
117 | <CustomServerUrl>http://182.19.10.91/AIAHTML5</CustomServerUrl> | 117 | <CustomServerUrl>http://182.19.10.91/AIAHTML5</CustomServerUrl> |
400-SOURCECODE/AIAHTML5.Web/AIAHTML5.Web.csproj
@@ -11,8 +11,8 @@ | @@ -11,8 +11,8 @@ | ||
11 | <ProjectTypeGuids>{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids> | 11 | <ProjectTypeGuids>{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids> |
12 | <OutputType>Library</OutputType> | 12 | <OutputType>Library</OutputType> |
13 | <AppDesignerFolder>Properties</AppDesignerFolder> | 13 | <AppDesignerFolder>Properties</AppDesignerFolder> |
14 | - <RootNamespace>AIA</RootNamespace> | ||
15 | - <AssemblyName>AIA</AssemblyName> | 14 | + <RootNamespace>eLearningPlayer</RootNamespace> |
15 | + <AssemblyName>eLearningPlayer</AssemblyName> | ||
16 | <TargetFrameworkVersion>v4.5</TargetFrameworkVersion> | 16 | <TargetFrameworkVersion>v4.5</TargetFrameworkVersion> |
17 | <UseIISExpress>false</UseIISExpress> | 17 | <UseIISExpress>false</UseIISExpress> |
18 | <IISExpressSSLPort /> | 18 | <IISExpressSSLPort /> |
@@ -10100,6 +10100,7 @@ | @@ -10100,6 +10100,7 @@ | ||
10100 | <Content Include="content\js\custom\custom.js" /> | 10100 | <Content Include="content\js\custom\custom.js" /> |
10101 | <Content Include="content\js\custom\main.js" /> | 10101 | <Content Include="content\js\custom\main.js" /> |
10102 | <Content Include="libs\angular\1.4.9\angular-route.min.js" /> | 10102 | <Content Include="libs\angular\1.4.9\angular-route.min.js" /> |
10103 | + <Content Include="libs\angular\1.4.9\ngStorage.js" /> | ||
10103 | <Content Include="libs\jinqJs.js" /> | 10104 | <Content Include="libs\jinqJs.js" /> |
10104 | <Content Include="libs\jquery\2.1.3\jquery.min.js" /> | 10105 | <Content Include="libs\jquery\2.1.3\jquery.min.js" /> |
10105 | <Content Include="libs\jquery\jquery_plugin\jsPanel\jspanel\fonts\jsglyph.svg" /> | 10106 | <Content Include="libs\jquery\jquery_plugin\jsPanel\jspanel\fonts\jsglyph.svg" /> |
@@ -10254,7 +10255,7 @@ | @@ -10254,7 +10255,7 @@ | ||
10254 | <AutoAssignPort>True</AutoAssignPort> | 10255 | <AutoAssignPort>True</AutoAssignPort> |
10255 | <DevelopmentServerPort>55837</DevelopmentServerPort> | 10256 | <DevelopmentServerPort>55837</DevelopmentServerPort> |
10256 | <DevelopmentServerVPath>/</DevelopmentServerVPath> | 10257 | <DevelopmentServerVPath>/</DevelopmentServerVPath> |
10257 | - <IISUrl>http://localhost/AIA</IISUrl> | 10258 | + <IISUrl>http://localhost/AIAHTML5</IISUrl> |
10258 | <NTLMAuthentication>False</NTLMAuthentication> | 10259 | <NTLMAuthentication>False</NTLMAuthentication> |
10259 | <UseCustomServer>False</UseCustomServer> | 10260 | <UseCustomServer>False</UseCustomServer> |
10260 | <CustomServerUrl>http://182.19.10.91/AIAHTML5</CustomServerUrl> | 10261 | <CustomServerUrl>http://182.19.10.91/AIAHTML5</CustomServerUrl> |
400-SOURCECODE/AIAHTML5.Web/AIAHTML5.Web.csproj.user
1 | <?xml version="1.0" encoding="utf-8"?> | 1 | <?xml version="1.0" encoding="utf-8"?> |
2 | <Project ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | 2 | <Project ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
3 | <PropertyGroup> | 3 | <PropertyGroup> |
4 | - <ProjectView>ShowAllFiles</ProjectView> | 4 | + <ProjectView>ProjectFiles</ProjectView> |
5 | </PropertyGroup> | 5 | </PropertyGroup> |
6 | <ProjectExtensions> | 6 | <ProjectExtensions> |
7 | <VisualStudio> | 7 | <VisualStudio> |
400-SOURCECODE/AIAHTML5.Web/Web.config
@@ -27,7 +27,7 @@ | @@ -27,7 +27,7 @@ | ||
27 | <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" /> | 27 | <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" /> |
28 | <add input="{REQUEST_URI}" pattern="^/(api)" negate="true" /> | 28 | <add input="{REQUEST_URI}" pattern="^/(api)" negate="true" /> |
29 | </conditions> | 29 | </conditions> |
30 | - <action type="Rewrite" url="/AIA/" /> | 30 | + <action type="Rewrite" url="/AIAHTML5/" /> |
31 | </rule> | 31 | </rule> |
32 | </rules> | 32 | </rules> |
33 | </rewrite> | 33 | </rewrite> |
@@ -38,7 +38,8 @@ | @@ -38,7 +38,8 @@ | ||
38 | <mimeMap fileExtension=".woff" mimeType="application/font-woff" /> | 38 | <mimeMap fileExtension=".woff" mimeType="application/font-woff" /> |
39 | <mimeMap fileExtension=".mp3" mimeType="audio/mpeg" /> | 39 | <mimeMap fileExtension=".mp3" mimeType="audio/mpeg" /> |
40 | <mimeMap fileExtension=".woff2" mimeType="application/font-woff2" /> | 40 | <mimeMap fileExtension=".woff2" mimeType="application/font-woff2" /> |
41 | - <mimeMap fileExtension=".json" mimeType="application/json" /> | 41 | + |
42 | + | ||
42 | </staticContent> | 43 | </staticContent> |
43 | <defaultDocument enabled="true"> | 44 | <defaultDocument enabled="true"> |
44 | <files> | 45 | <files> |
400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js
@@ -87,8 +87,11 @@ function ($scope,$rootScope, $compile,$http, $log, $location, $timeout,DA,Module | @@ -87,8 +87,11 @@ function ($scope,$rootScope, $compile,$http, $log, $location, $timeout,DA,Module | ||
87 | $scope.openView = function ($event) { | 87 | $scope.openView = function ($event) { |
88 | // debugger; | 88 | // debugger; |
89 | $rootScope.currentBodyViewId = $event.currentTarget.id; | 89 | $rootScope.currentBodyViewId = $event.currentTarget.id; |
90 | - | ||
91 | $rootScope.ViewTitle = $event.currentTarget.textContent; | 90 | $rootScope.ViewTitle = $event.currentTarget.textContent; |
91 | + | ||
92 | + localStorage.setItem("currentViewTitleFromJson", $event.currentTarget.textContent); | ||
93 | + localStorage.setItem("currentBodyViewId", $event.currentTarget.id); | ||
94 | + | ||
92 | var u = $location.url(); | 95 | var u = $location.url(); |
93 | $location.url('/da-body-view'); | 96 | $location.url('/da-body-view'); |
94 | 97 | ||
@@ -144,28 +147,34 @@ function ($scope,$rootScope, $compile,$http, $log, $location, $timeout,DA,Module | @@ -144,28 +147,34 @@ function ($scope,$rootScope, $compile,$http, $log, $location, $timeout,DA,Module | ||
144 | 147 | ||
145 | 148 | ||
146 | var openViews; | 149 | var openViews; |
147 | - // debugger; | 150 | + var currentBodyViewId = localStorage.getItem("currentBodyViewId"); |
151 | + debugger; | ||
148 | if ($rootScope.openViews.length>0) { | 152 | if ($rootScope.openViews.length>0) { |
149 | openViews = new jinqJs() | 153 | openViews = new jinqJs() |
150 | .from($rootScope.openViews) | 154 | .from($rootScope.openViews) |
151 | - .where("BodyViewId==" + $rootScope.currentBodyViewId) | 155 | + .where("BodyViewId==" + currentBodyViewId) |
152 | .select(); | 156 | .select(); |
153 | } | 157 | } |
154 | var counter = 1; | 158 | var counter = 1; |
155 | 159 | ||
156 | - var tittle = $rootScope.ViewTitle; | 160 | + // var tittle = $rootScope.ViewTitle; |
161 | + var tittle = localStorage.getItem("currentViewTitleFromJson"); | ||
157 | 162 | ||
158 | if (openViews!=null && openViews.length > 0) | 163 | if (openViews!=null && openViews.length > 0) |
159 | { | 164 | { |
160 | angular.forEach(openViews, function (value, key) { | 165 | angular.forEach(openViews, function (value, key) { |
161 | 166 | ||
162 | - if (value.BodyViews == tittle) { | ||
163 | - tittle = $rootScope.ViewTitle + counter++; | 167 | + if (value.BodyView == tittle) { |
168 | + tittle = localStorage.getItem("currentViewTitleFromJson") + counter++; | ||
164 | $rootScope.currentActiveViewTitle = tittle; | 169 | $rootScope.currentActiveViewTitle = tittle; |
170 | + localStorage.setItem("currentViewTitle", tittle); | ||
165 | } | 171 | } |
166 | 172 | ||
167 | }); | 173 | }); |
168 | - } | 174 | + } |
175 | + else { | ||
176 | + localStorage.setItem("currentViewTitle", tittle); | ||
177 | + } | ||
169 | 178 | ||
170 | 179 | ||
171 | 180 | ||
@@ -176,7 +185,7 @@ function ($scope,$rootScope, $compile,$http, $log, $location, $timeout,DA,Module | @@ -176,7 +185,7 @@ function ($scope,$rootScope, $compile,$http, $log, $location, $timeout,DA,Module | ||
176 | ajax: { | 185 | ajax: { |
177 | url: 'app/views/da/da-view.html' | 186 | url: 'app/views/da/da-view.html' |
178 | }, | 187 | }, |
179 | - title: tittle, | 188 | + title: localStorage.getItem("currentViewTitle"), |
180 | // bootstrap: 'columns large-10 medium-9', | 189 | // bootstrap: 'columns large-10 medium-9', |
181 | position: { | 190 | position: { |
182 | top: 70, //50, | 191 | top: 70, //50, |
@@ -240,9 +249,9 @@ function ($scope,$rootScope, $compile,$http, $log, $location, $timeout,DA,Module | @@ -240,9 +249,9 @@ function ($scope,$rootScope, $compile,$http, $log, $location, $timeout,DA,Module | ||
240 | .error(function (data, status, headers, config) { | 249 | .error(function (data, status, headers, config) { |
241 | console.log(data); | 250 | console.log(data); |
242 | }); | 251 | }); |
243 | - // debugger; | 252 | + debugger; |
244 | 253 | ||
245 | - $scope.voId = $rootScope.currentBodyViewId; | 254 | + $scope.voId = localStorage.getItem("currentBodyViewId");; |
246 | $scope.layerNo = 0; | 255 | $scope.layerNo = 0; |
247 | $scope.skinTone = DA[0].ethnicity; | 256 | $scope.skinTone = DA[0].ethnicity; |
248 | 257 |
400-SOURCECODE/AIAHTML5.Web/app/controllers/HomeController.js
@@ -7,7 +7,7 @@ AIA.controller("HomeController", ["$rootScope","Modules", "$log", "$location", " | @@ -7,7 +7,7 @@ AIA.controller("HomeController", ["$rootScope","Modules", "$log", "$location", " | ||
7 | // name: 'MainMenu' | 7 | // name: 'MainMenu' |
8 | //}; | 8 | //}; |
9 | $rootScope.pageToOpen = 'app/widget/MainMenu.html'; | 9 | $rootScope.pageToOpen = 'app/widget/MainMenu.html'; |
10 | - $rootScope.currentBodyViewId = 1; | 10 | + $rootScope.currentBodyViewId ; |
11 | $rootScope.currentActiveModuleTitle = 'Welcome to A.D.A.M. Interactive Anatomy';//Modules[0].Name; | 11 | $rootScope.currentActiveModuleTitle = 'Welcome to A.D.A.M. Interactive Anatomy';//Modules[0].Name; |
12 | $rootScope.currentActiveViewTitle; | 12 | $rootScope.currentActiveViewTitle; |
13 | $rootScope.cuurentActiveModuleId; | 13 | $rootScope.cuurentActiveModuleId; |
@@ -15,7 +15,7 @@ AIA.controller("HomeController", ["$rootScope","Modules", "$log", "$location", " | @@ -15,7 +15,7 @@ AIA.controller("HomeController", ["$rootScope","Modules", "$log", "$location", " | ||
15 | $rootScope.openViews = []; | 15 | $rootScope.openViews = []; |
16 | $rootScope.currentSlug; | 16 | $rootScope.currentSlug; |
17 | $rootScope.jsPanelTitle; | 17 | $rootScope.jsPanelTitle; |
18 | - | 18 | + $rootScope.ViewTitle; |
19 | 19 | ||
20 | $rootScope.ClearIframe = function () { | 20 | $rootScope.ClearIframe = function () { |
21 | if ($('#daImagePanel')!=null) | 21 | if ($('#daImagePanel')!=null) |
400-SOURCECODE/AIAHTML5.Web/app/main/AIA.js
400-SOURCECODE/AIAHTML5.Web/app/views/da/da-view.html
1 | <div class=" "> | 1 | <div class=" "> |
2 | - <div class=" leftToolBar tools pull-left "> | 2 | + <div class="leftToolBar tools pull-left"> |
3 | <div class="toggle-icon toggleBar toggleHeadingButton" title="Show/Hide Sidebar" style="top:20px;"></div> | 3 | <div class="toggle-icon toggleBar toggleHeadingButton" title="Show/Hide Sidebar" style="top:20px;"></div> |
4 | <div class="" style="top:20px"> | 4 | <div class="" style="top:20px"> |
5 | <div class="col-sm-6" title="Identify"> | 5 | <div class="col-sm-6" title="Identify"> |
400-SOURCECODE/AIAHTML5.Web/app/widget/MainView.html
1 | <div class="bodyWrap row" ng-init="ClearIframe()"> | 1 | <div class="bodyWrap row" ng-init="ClearIframe()"> |
2 | <div ng-include="'app/widget/MainMenu.html'"/> | 2 | <div ng-include="'app/widget/MainMenu.html'"/> |
3 | <div class="main"> | 3 | <div class="main"> |
4 | - <div class="col-sm-12"> | 4 | + <div class="col-sm-12" style="padding-left:25px; width:99%"> |
5 | <div align="center" id="MainImage"><img src="content/images/img1.png" alt="" title="" class="img-responsive"></div> | 5 | <div align="center" id="MainImage"><img src="content/images/img1.png" alt="" title="" class="img-responsive"></div> |
6 | <!--<div ng-view></div>--> | 6 | <!--<div ng-view></div>--> |
7 | </div> | 7 | </div> |
400-SOURCECODE/AIAHTML5.Web/index.html
1 | <!DOCTYPE html> | 1 | <!DOCTYPE html> |
2 | <html lang="en" ng-cloak ng-app="AIA"> | 2 | <html lang="en" ng-cloak ng-app="AIA"> |
3 | <head> | 3 | <head> |
4 | - <base href="/AIA/" /> | 4 | + <base href="/AIAHTML5/" /> |
5 | <meta charset="utf-8"> | 5 | <meta charset="utf-8"> |
6 | <meta http-equiv="X-UA-Compatible" content="IE=edge"> | 6 | <meta http-equiv="X-UA-Compatible" content="IE=edge"> |
7 | <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no"> | 7 | <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no"> |
@@ -134,6 +134,7 @@ | @@ -134,6 +134,7 @@ | ||
134 | <script src="libs/angular/1.4.9/angular.min.js"></script> | 134 | <script src="libs/angular/1.4.9/angular.min.js"></script> |
135 | <script src="libs/angular/1.4.9/angular-route.min.js"></script> | 135 | <script src="libs/angular/1.4.9/angular-route.min.js"></script> |
136 | <script src="libs/angular/1.4.9/angular-sanitize.min.js"></script> | 136 | <script src="libs/angular/1.4.9/angular-sanitize.min.js"></script> |
137 | + <script src="libs/angular/1.4.9/ngStorage.js"></script> | ||
137 | <script src="content/js/custom/custom.js"></script> | 138 | <script src="content/js/custom/custom.js"></script> |
138 | <script src="libs/jinqJs.js"></script> | 139 | <script src="libs/jinqJs.js"></script> |
139 | <script src="libs/jquery/jquery_plugin/jsPanel/jspanel/jquery.jspanel.js"></script> | 140 | <script src="libs/jquery/jquery_plugin/jsPanel/jspanel/jquery.jspanel.js"></script> |
400-SOURCECODE/AIAHTML5.Web/libs/angular/1.4.9/ngStorage.js
0 → 100644
1 | +(function (root, factory) { | ||
2 | + 'use strict'; | ||
3 | + | ||
4 | + if (typeof define === 'function' && define.amd) { | ||
5 | + define(['angular'], factory); | ||
6 | + } else if (root.hasOwnProperty('angular')) { | ||
7 | + // Browser globals (root is window), we don't register it. | ||
8 | + factory(root.angular); | ||
9 | + } else if (typeof exports === 'object') { | ||
10 | + module.exports = factory(require('angular')); | ||
11 | + } | ||
12 | +}(this, function (angular) { | ||
13 | + 'use strict'; | ||
14 | + | ||
15 | + // In cases where Angular does not get passed or angular is a truthy value | ||
16 | + // but misses .module we can fall back to using window. | ||
17 | + angular = (angular && angular.module) ? angular : window.angular; | ||
18 | + | ||
19 | + | ||
20 | + function isStorageSupported($window, storageType) { | ||
21 | + | ||
22 | + // Some installations of IE, for an unknown reason, throw "SCRIPT5: Error: Access is denied" | ||
23 | + // when accessing window.localStorage. This happens before you try to do anything with it. Catch | ||
24 | + // that error and allow execution to continue. | ||
25 | + | ||
26 | + // fix 'SecurityError: DOM Exception 18' exception in Desktop Safari, Mobile Safari | ||
27 | + // when "Block cookies": "Always block" is turned on | ||
28 | + var supported; | ||
29 | + try { | ||
30 | + supported = $window[storageType]; | ||
31 | + } | ||
32 | + catch (err) { | ||
33 | + supported = false; | ||
34 | + } | ||
35 | + | ||
36 | + // When Safari (OS X or iOS) is in private browsing mode, it appears as though localStorage | ||
37 | + // is available, but trying to call .setItem throws an exception below: | ||
38 | + // "QUOTA_EXCEEDED_ERR: DOM Exception 22: An attempt was made to add something to storage that exceeded the quota." | ||
39 | + if (supported && storageType === 'localStorage') { | ||
40 | + var key = '__' + Math.round(Math.random() * 1e7); | ||
41 | + | ||
42 | + try { | ||
43 | + localStorage.setItem(key, key); | ||
44 | + localStorage.removeItem(key); | ||
45 | + } | ||
46 | + catch (err) { | ||
47 | + supported = false; | ||
48 | + } | ||
49 | + } | ||
50 | + | ||
51 | + return supported; | ||
52 | + } | ||
53 | + | ||
54 | + /** | ||
55 | + * @ngdoc overview | ||
56 | + * @name ngStorage | ||
57 | + */ | ||
58 | + | ||
59 | + return angular.module('ngStorage', []) | ||
60 | + | ||
61 | + /** | ||
62 | + * @ngdoc object | ||
63 | + * @name ngStorage.$localStorage | ||
64 | + * @requires $rootScope | ||
65 | + * @requires $window | ||
66 | + */ | ||
67 | + | ||
68 | + .provider('$localStorage', _storageProvider('localStorage')) | ||
69 | + | ||
70 | + /** | ||
71 | + * @ngdoc object | ||
72 | + * @name ngStorage.$sessionStorage | ||
73 | + * @requires $rootScope | ||
74 | + * @requires $window | ||
75 | + */ | ||
76 | + | ||
77 | + .provider('$sessionStorage', _storageProvider('sessionStorage')); | ||
78 | + | ||
79 | + function _storageProvider(storageType) { | ||
80 | + var providerWebStorage = isStorageSupported(window, storageType); | ||
81 | + | ||
82 | + return function () { | ||
83 | + var storageKeyPrefix = 'ngStorage-'; | ||
84 | + | ||
85 | + this.setKeyPrefix = function (prefix) { | ||
86 | + if (typeof prefix !== 'string') { | ||
87 | + throw new TypeError('[ngStorage] - ' + storageType + 'Provider.setKeyPrefix() expects a String.'); | ||
88 | + } | ||
89 | + storageKeyPrefix = prefix; | ||
90 | + }; | ||
91 | + | ||
92 | + var serializer = angular.toJson; | ||
93 | + var deserializer = angular.fromJson; | ||
94 | + | ||
95 | + this.setSerializer = function (s) { | ||
96 | + if (typeof s !== 'function') { | ||
97 | + throw new TypeError('[ngStorage] - ' + storageType + 'Provider.setSerializer expects a function.'); | ||
98 | + } | ||
99 | + | ||
100 | + serializer = s; | ||
101 | + }; | ||
102 | + | ||
103 | + this.setDeserializer = function (d) { | ||
104 | + if (typeof d !== 'function') { | ||
105 | + throw new TypeError('[ngStorage] - ' + storageType + 'Provider.setDeserializer expects a function.'); | ||
106 | + } | ||
107 | + | ||
108 | + deserializer = d; | ||
109 | + }; | ||
110 | + | ||
111 | + this.supported = function () { | ||
112 | + return !!providerWebStorage; | ||
113 | + }; | ||
114 | + | ||
115 | + // Note: This is not very elegant at all. | ||
116 | + this.get = function (key) { | ||
117 | + return providerWebStorage && deserializer(providerWebStorage.getItem(storageKeyPrefix + key)); | ||
118 | + }; | ||
119 | + | ||
120 | + // Note: This is not very elegant at all. | ||
121 | + this.set = function (key, value) { | ||
122 | + return providerWebStorage && providerWebStorage.setItem(storageKeyPrefix + key, serializer(value)); | ||
123 | + }; | ||
124 | + | ||
125 | + this.$get = [ | ||
126 | + '$rootScope', | ||
127 | + '$window', | ||
128 | + '$log', | ||
129 | + '$timeout', | ||
130 | + '$document', | ||
131 | + | ||
132 | + function ( | ||
133 | + $rootScope, | ||
134 | + $window, | ||
135 | + $log, | ||
136 | + $timeout, | ||
137 | + $document | ||
138 | + ) { | ||
139 | + | ||
140 | + // The magic number 10 is used which only works for some keyPrefixes... | ||
141 | + // See https://github.com/gsklee/ngStorage/issues/137 | ||
142 | + var prefixLength = storageKeyPrefix.length; | ||
143 | + | ||
144 | + // #9: Assign a placeholder object if Web Storage is unavailable to prevent breaking the entire AngularJS app | ||
145 | + // Note: recheck mainly for testing (so we can use $window[storageType] rather than window[storageType]) | ||
146 | + var isSupported = isStorageSupported($window, storageType), | ||
147 | + webStorage = isSupported || ($log.warn('This browser does not support Web Storage!'), { setItem: angular.noop, getItem: angular.noop, removeItem: angular.noop }), | ||
148 | + $storage = { | ||
149 | + $default: function (items) { | ||
150 | + for (var k in items) { | ||
151 | + angular.isDefined($storage[k]) || ($storage[k] = angular.copy(items[k])); | ||
152 | + } | ||
153 | + | ||
154 | + $storage.$sync(); | ||
155 | + return $storage; | ||
156 | + }, | ||
157 | + $reset: function (items) { | ||
158 | + for (var k in $storage) { | ||
159 | + '$' === k[0] || (delete $storage[k] && webStorage.removeItem(storageKeyPrefix + k)); | ||
160 | + } | ||
161 | + | ||
162 | + return $storage.$default(items); | ||
163 | + }, | ||
164 | + $sync: function () { | ||
165 | + for (var i = 0, l = webStorage.length, k; i < l; i++) { | ||
166 | + // #8, #10: `webStorage.key(i)` may be an empty string (or throw an exception in IE9 if `webStorage` is empty) | ||
167 | + (k = webStorage.key(i)) && storageKeyPrefix === k.slice(0, prefixLength) && ($storage[k.slice(prefixLength)] = deserializer(webStorage.getItem(k))); | ||
168 | + } | ||
169 | + }, | ||
170 | + $apply: function () { | ||
171 | + var temp$storage; | ||
172 | + | ||
173 | + _debounce = null; | ||
174 | + | ||
175 | + if (!angular.equals($storage, _last$storage)) { | ||
176 | + temp$storage = angular.copy(_last$storage); | ||
177 | + angular.forEach($storage, function (v, k) { | ||
178 | + if (angular.isDefined(v) && '$' !== k[0]) { | ||
179 | + webStorage.setItem(storageKeyPrefix + k, serializer(v)); | ||
180 | + delete temp$storage[k]; | ||
181 | + } | ||
182 | + }); | ||
183 | + | ||
184 | + for (var k in temp$storage) { | ||
185 | + webStorage.removeItem(storageKeyPrefix + k); | ||
186 | + } | ||
187 | + | ||
188 | + _last$storage = angular.copy($storage); | ||
189 | + } | ||
190 | + }, | ||
191 | + $supported: function () { | ||
192 | + return !!isSupported; | ||
193 | + } | ||
194 | + }, | ||
195 | + _last$storage, | ||
196 | + _debounce; | ||
197 | + | ||
198 | + $storage.$sync(); | ||
199 | + | ||
200 | + _last$storage = angular.copy($storage); | ||
201 | + | ||
202 | + $rootScope.$watch(function () { | ||
203 | + _debounce || (_debounce = $timeout($storage.$apply, 100, false)); | ||
204 | + }); | ||
205 | + | ||
206 | + // #6: Use `$window.addEventListener` instead of `angular.element` to avoid the jQuery-specific `event.originalEvent` | ||
207 | + $window.addEventListener && $window.addEventListener('storage', function (event) { | ||
208 | + if (!event.key) { | ||
209 | + return; | ||
210 | + } | ||
211 | + | ||
212 | + // Reference doc. | ||
213 | + var doc = $document[0]; | ||
214 | + | ||
215 | + if ((!doc.hasFocus || !doc.hasFocus()) && storageKeyPrefix === event.key.slice(0, prefixLength)) { | ||
216 | + event.newValue ? $storage[event.key.slice(prefixLength)] = deserializer(event.newValue) : delete $storage[event.key.slice(prefixLength)]; | ||
217 | + | ||
218 | + _last$storage = angular.copy($storage); | ||
219 | + | ||
220 | + $rootScope.$apply(); | ||
221 | + } | ||
222 | + }); | ||
223 | + | ||
224 | + $window.addEventListener && $window.addEventListener('beforeunload', function () { | ||
225 | + $storage.$apply(); | ||
226 | + }); | ||
227 | + | ||
228 | + return $storage; | ||
229 | + } | ||
230 | + ]; | ||
231 | + }; | ||
232 | + } | ||
233 | + | ||
234 | +})); | ||
0 | \ No newline at end of file | 235 | \ No newline at end of file |
400-SOURCECODE/AIAHTML5.Web/login.html
1 | <!DOCTYPE html> | 1 | <!DOCTYPE html> |
2 | <html lang="en"> | 2 | <html lang="en"> |
3 | <head> | 3 | <head> |
4 | - <base href="/AIA/" /> | 4 | + <base href="/AIAHTML5/" /> |
5 | <meta charset="utf-8"> | 5 | <meta charset="utf-8"> |
6 | <meta http-equiv="X-UA-Compatible" content="IE=edge"> | 6 | <meta http-equiv="X-UA-Compatible" content="IE=edge"> |
7 | <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no"> | 7 | <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no"> |