From b8b2f4392981de9cc25a422ddef51e8cced18eb3 Mon Sep 17 00:00:00 2001 From: benakamoorthi <benaka.moorthi@gmail.com> Date: Thu, 26 Jul 2012 18:04:28 +0000 Subject: [PATCH] Fixes #3188, move workaround to default theme's common.js file. git-svn-id: http://dev.piwik.org/svn/trunk@6570 59fd770c-687e-43c8-a1e3-f5a4ff64c105 --- plugins/CoreHome/CoreHome.php | 2 -- plugins/CoreHome/templates/workarounds.js | 20 -------------------- themes/default/common.js | 17 +++++++++++++++++ 3 files changed, 17 insertions(+), 22 deletions(-) delete mode 100755 plugins/CoreHome/templates/workarounds.js diff --git a/plugins/CoreHome/CoreHome.php b/plugins/CoreHome/CoreHome.php index 1d91185fa2..d0361c571a 100644 --- a/plugins/CoreHome/CoreHome.php +++ b/plugins/CoreHome/CoreHome.php @@ -78,8 +78,6 @@ class Piwik_CoreHome extends Piwik_Plugin $jsFiles[] = "plugins/CoreHome/templates/jqplot.js"; $jsFiles[] = "libs/jqplot/jqplot-custom.min.js"; - - $jsFiles[] = "plugins/CoreHome/templates/workarounds.js"; } } diff --git a/plugins/CoreHome/templates/workarounds.js b/plugins/CoreHome/templates/workarounds.js deleted file mode 100755 index 68f93aa28c..0000000000 --- a/plugins/CoreHome/templates/workarounds.js +++ /dev/null @@ -1,20 +0,0 @@ -/*! - * Piwik - Web Analytics - * - * @link http://piwik.org - * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later - */ - -(function($){ - -// monkey patch that works around bug in some arc function of some browsers where -// nothing gets drawn if angles are exactly 2 * PI apart. -// affects some versions of chrome & IE 8 -var oldArc = CanvasRenderingContext2D.prototype.arc; -CanvasRenderingContext2D.prototype.arc = function(x, y, r, sAngle, eAngle, clockwise) { - if (Math.abs(sAngle - eAngle) === Math.PI * 2) - eAngle -= 0.000001; - oldArc.call(this, x, y, r, sAngle, eAngle, clockwise); -}; - -}(jQuery)); diff --git a/themes/default/common.js b/themes/default/common.js index 3f908e3ba7..bae4d708a6 100644 --- a/themes/default/common.js +++ b/themes/default/common.js @@ -337,3 +337,20 @@ function isEnterKey(e) { return (window.event?window.event.keyCode:e.which)==13; } + +// workarounds +(function($){ +try { // this code is not vital, so we make sure any errors are ignored + +// monkey patch that works around bug in arc function of some browsers where +// nothing gets drawn if angles are exactly 2 * PI apart. +// affects some versions of chrome & IE 8 +var oldArc = CanvasRenderingContext2D.prototype.arc; +CanvasRenderingContext2D.prototype.arc = function(x, y, r, sAngle, eAngle, clockwise) { + if (Math.abs(sAngle - eAngle) === Math.PI * 2) + eAngle -= 0.000001; + oldArc.call(this, x, y, r, sAngle, eAngle, clockwise); +}; + +} catch (e) {} +}(jQuery)); -- GitLab