Permalink
Browse files

Changed to top.orientation so the plugin also works inside an iframe

  • Loading branch information...
1 parent 5afa3bc commit ef3c41b9b5161740993d09a3632251e2be2efc20 @fieldOfView committed Jun 2, 2011
Showing with 6 additions and 6 deletions.
  1. +2 −2 orientation.js
  2. +4 −4 orientation/source/orientation.source.js
View
@@ -7,5 +7,5 @@ This software can be used free of charge and the source code is available under
http://creativecommons.org/licenses/by/3.0/
*/
-var krpanoplugin=function(){function g(){c=window.orientation;d=Math.abs(c)==90;f=!d;a.call(e)}var a=null,b=null,e="",c=window.orientation===void 0?0:window.orientation,d=Math.abs(c)==90,f=!d;this.registerplugin=function(h,j,i){a=h;b=i;a.version<"1.0.8.14"||a.build<"2011-03-30"?a.trace(3,"orientation plugin - too old krpano version (min. 1.0.8.14)"):(window.addEventListener("orientationchange",g,!0),b.registerattribute("orientation",c,function(){},function(){return c}),b.registerattribute("landscape",
-d,function(){},function(){return d}),b.registerattribute("portrait",f,function(){},function(){return f}),b.registerattribute("onorientationchange",e,function(a){e=a},function(){return e}))};this.unloadplugin=function(){window.removeEventListener("orientationchange",g);a=b=null}};
+var krpanoplugin=function(){function g(){c=top.orientation;d=Math.abs(c)==90;f=!d;a.call(e)}var a=null,b=null,e="",c=top.orientation===void 0?0:top.orientation,d=Math.abs(c)==90,f=!d;this.registerplugin=function(h,j,i){a=h;b=i;a.version<"1.0.8.14"||a.build<"2011-03-30"?a.trace(3,"orientation plugin - too old krpano version (min. 1.0.8.14)"):(top.addEventListener("orientationchange",g,!0),b.registerattribute("orientation",c,function(){},function(){return c}),b.registerattribute("landscape",
+d,function(){},function(){return d}),b.registerattribute("portrait",f,function(){},function(){return f}),b.registerattribute("onorientationchange",e,function(a){e=a},function(){return e}))};this.unloadplugin=function(){top.removeEventListener("orientationchange",g);a=b=null}};
@@ -13,7 +13,7 @@ var krpanoplugin = function()
krpano = null, plugin = null,
onOrientationChange = "",
- orientation = (window.orientation === undefined)?0:window.orientation,
+ orientation = (top.orientation === undefined)?0:top.orientation,
landscape = (Math.abs(orientation) == 90),
portrait = !landscape;
@@ -31,7 +31,7 @@ var krpanoplugin = function()
return;
}
- window.addEventListener("orientationchange", handleOrientationChange, true);
+ top.addEventListener("orientationchange", handleOrientationChange, true);
// register attributes
plugin.registerattribute("orientation", orientation, function(arg){}, function(){ return orientation; });
@@ -43,7 +43,7 @@ var krpanoplugin = function()
local.unloadplugin = function()
{
- window.removeEventListener("orientationchange", handleOrientationChange);
+ top.removeEventListener("orientationchange", handleOrientationChange);
plugin = null;
krpano = null;
@@ -58,7 +58,7 @@ var krpanoplugin = function()
function handleOrientationChange(event)
{
- orientation = window.orientation;
+ orientation = top.orientation;
landscape = (Math.abs(orientation) == 90),
portrait = !landscape;

0 comments on commit ef3c41b

Please sign in to comment.