diff options
author | diosmosis <benaka.moorthi@gmail.com> | 2013-02-26 02:04:50 +0400 |
---|---|---|
committer | diosmosis <benaka.moorthi@gmail.com> | 2013-02-26 02:04:50 +0400 |
commit | c6ac229c8e7d6cf032d50ae604f829933b11fd73 (patch) | |
tree | b42d93231c2abe6ccd5e6175a43bd72ced0f77d2 /plugins/SitesManager | |
parent | b3486f7d33f00f750e92ee94bda2ef6c4746ea83 (diff) |
Refs #1845, switch to async JS in other places and apply fixes to tracking code admin page & other pages.
Notes:
* Fix bug in Installation page that displays JS where newlines were not displayed and text would not be selected on click.
* Modify piwik.js to make sure setTrackerUrl is called before _paq is processed.
* Move _paq modifications in tracker code to global scope outside every anonymous function.
* Fix bug in rewritten site selector widget where selecting the same site didn't fire an event (necessary for some uses).
* Fix bug where change of site resulted in delay before site name in labels changed.
* Fix bug where site name was double encoded in tracking code admin page.
* Rewrite piwik_tag.tpl to use async tracking code.
Diffstat (limited to 'plugins/SitesManager')
-rw-r--r-- | plugins/SitesManager/templates/DisplayJavascriptCode.tpl | 32 | ||||
-rw-r--r-- | plugins/SitesManager/templates/SitesManager.tpl | 2 |
2 files changed, 31 insertions, 3 deletions
diff --git a/plugins/SitesManager/templates/DisplayJavascriptCode.tpl b/plugins/SitesManager/templates/DisplayJavascriptCode.tpl index 3e0b7e1aa7..51bf27e2fd 100644 --- a/plugins/SitesManager/templates/DisplayJavascriptCode.tpl +++ b/plugins/SitesManager/templates/DisplayJavascriptCode.tpl @@ -27,7 +27,7 @@ p { <h3>{'SitesManager_JsTrackingTag'|translate}</h3> <p>{'CoreAdminHome_JSTracking_CodeNote'|translate:"</body>"}</p> -<code>{$jsTag}</code> +<pre class="code-pre"><code>{$jsTag}</code></pre> <br /> {'CoreAdminHome_JSTrackingIntro5'|translate:'<a target="_blank" href="http://piwik.org/docs/javascript-tracking/">':'</a>'} @@ -35,4 +35,32 @@ p { {'Installation_JSTracking_EndNote'|translate:'<em>':'</em>'} </div> - +{literal} +<script type="text/javascript"> +$(document).ready(function () { + // when code element is clicked, select the text + $('code').click(function () { + // credit where credit is due: + // http://stackoverflow.com/questions/1173194/select-all-div-text-with-single-mouse-click + var range; + if (document.body.createTextRange) // MSIE + { + range = document.body.createTextRange(); + range.moveToElementText(this); + range.select(); + } + else if (window.getSelection) // others + { + range = document.createRange(); + range.selectNodeContents(this); + + var selection = window.getSelection(); + selection.removeAllRanges(); + selection.addRange(range); + } + }); + + $('code').click(); +}); +</script> +{/literal} diff --git a/plugins/SitesManager/templates/SitesManager.tpl b/plugins/SitesManager/templates/SitesManager.tpl index edf772452d..775e82f816 100644 --- a/plugins/SitesManager/templates/SitesManager.tpl +++ b/plugins/SitesManager/templates/SitesManager.tpl @@ -187,7 +187,7 @@ vertical-align:middle; <td id="ecommerce" class="editableSite">{if $site.ecommerce}<span class='ecommerceActive'>{'General_Yes'|translate}</span>{else}<span class='ecommerceInactive'>-</span>{/if}</td> <td><span id="row{$site.idsite}" class='editSite link_but'><img src='themes/default/images/ico_edit.png' title="{'General_Edit'|translate}" border="0"/> {'General_Edit'|translate}</span></td> <td><span id="row{$site.idsite}" class="deleteSite link_but"><img src='themes/default/images/ico_delete.png' title="{'General_Delete'|translate}" border="0" /> {'General_Delete'|translate}</span></td> - <td><a href='{url action=displayJavascriptCode idSite=$site.idsite updated=false}'>{'SitesManager_ShowTrackingTag'|translate}</a></td> + <td><a href='{url module=CoreAdminHome action=trackingCodeGenerator idSite=$site.idsite updated=false}'>{'SitesManager_ShowTrackingTag'|translate}</a></td> </tr> {/foreach} </tbody> |