Bugzilla – Attachment 15101 Details for
Bug 9424
Move JavaScript out of header include
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 9424 - Move JavaScript out of header include
Bug-9424---Move-JavaScript-out-of-header-include.patch (text/plain), 7.85 KB, created by
Owen Leonard
on 2013-02-06 14:20:03 UTC
(
hide
)
Description:
Bug 9424 - Move JavaScript out of header include
Filename:
MIME Type:
Creator:
Owen Leonard
Created:
2013-02-06 14:20:03 UTC
Size:
7.85 KB
patch
obsolete
>From b02593168c8277cce9f0e1e9a2783095a2d117d3 Mon Sep 17 00:00:00 2001 >From: Owen Leonard <oleonard@myacpl.org> >Date: Fri, 18 Jan 2013 09:47:55 -0500 >Subject: [PATCH] Bug 9424 - Move JavaScript out of header include >Content-Type: text/plain; charset="utf-8" > >This patch removes JavaScript "onlick" attributes from header.inc and >moves the functionality to staff-global.js. This is in keeping with the >idea of progressive enhancement. > >This patch also makes a couple of minor changes to staff-global.js to >fix jsHint warnings. > >To test, be sure to clear your browser cache after applying the patch. >Test the logout link under several conditions: > >- intranetbookbag enabled, virtualshelves enabled >- intranetbookbag enabled, virtualshelves disabled >- intranetbookbag disabled, virtualshelves enabled >- intranetbookbag disabled, virtualshelves disabled > >Logout should be successful with no JavaScript errors. This array of >tests is required because of the Cart-clearing action of logging out and >the changes made in this patch to the way Car/Lists JavaScript is >included. >--- > .../prog/en/includes/doc-head-close.inc | 31 ++++++++++---------- > .../intranet-tmpl/prog/en/includes/header.inc | 8 ++--- > koha-tmpl/intranet-tmpl/prog/en/js/staff-global.js | 25 +++++++++++++--- > 3 files changed, 38 insertions(+), 26 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/doc-head-close.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/doc-head-close.inc >index f677ed9..6ee99bd 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/doc-head-close.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/doc-head-close.inc >@@ -40,25 +40,24 @@ > //]]> > </script> > [% END %] >+[% IF ( virtualshelves || intranetbookbag ) %] > <script type="text/javascript"> > //<![CDATA[ >- [% IF ( intranetbookbag ) %]var MSG_BASKET_EMPTY = _("Your cart is currently empty"); >- var MSG_RECORD_IN_BASKET = _("This item is already in your cart"); >- var MSG_RECORD_ADDED = _("This item has been added to your cart"); >- var MSG_NRECORDS_ADDED = _(" item(s) added to your cart"); >- var MSG_NRECORDS_IN_BASKET = _("already in your cart"); >- var MSG_NO_RECORD_SELECTED = _("No item was selected"); >- var MSG_NO_RECORD_ADDED = _("No item was added to your cart"); >- var MSG_CONFIRM_DEL_BASKET = _("Are you sure you want to empty your cart?"); >- var MSG_CONFIRM_DEL_RECORDS = _("Are you sure you want to remove the selected items?"); >- var MSG_IN_YOUR_CART = _("Items in your cart: "); >- var MSG_NON_RESERVES_SELECTED = _("One or more selected items cannot be reserved."); >- [% END %] >+ var MSG_BASKET_EMPTY = _("Your cart is currently empty"); >+ var MSG_RECORD_IN_BASKET = _("This item is already in your cart"); >+ var MSG_RECORD_ADDED = _("This item has been added to your cart"); >+ var MSG_NRECORDS_ADDED = _(" item(s) added to your cart"); >+ var MSG_NRECORDS_IN_BASKET = _("already in your cart"); >+ var MSG_NO_RECORD_SELECTED = _("No item was selected"); >+ var MSG_NO_RECORD_ADDED = _("No item was added to your cart"); >+ var MSG_CONFIRM_DEL_BASKET = _("Are you sure you want to empty your cart?"); >+ var MSG_CONFIRM_DEL_RECORDS = _("Are you sure you want to remove the selected items?"); >+ var MSG_IN_YOUR_CART = _("Items in your cart: "); >+ var MSG_NON_RESERVES_SELECTED = _("One or more selected items cannot be reserved."); > //]]> >- </script> >- [% IF ( virtualshelves || intranetbookbag ) %] >- <script type="text/javascript" src="[% themelang %]/js/basket.js"></script> >- [% END %] >+</script> >+<script type="text/javascript" language="javascript" src="[% themelang %]/js/basket.js"></script> >+[% END %] > [% IF LocalCoverImages %] > <script type="text/javascript" src="[% themelang %]/js/localcovers.js"></script> > <script type="text/javascript"> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/header.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/header.inc >index eaf1481..f941481 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/header.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/header.inc >@@ -70,14 +70,10 @@ > <span class="loggedinusername"> > [% loggedinusername %] > </span> >- [% IF ( intranetbookbag ) %] >- ( <a class="toplinks" href="/cgi-bin/koha/mainpage.pl?logout.x=1" onclick="clearHoldFor(); delBasket('main', true);">Log out</a> ) | >- [% ELSE %] >- ( <a class="toplinks" href="/cgi-bin/koha/mainpage.pl?logout.x=1" onclick="clearHoldFor();">Log out</a> ) | >- [% END %] >+ ( <a id="logout" class="toplinks" href="/cgi-bin/koha/mainpage.pl?logout.x=1">Log out</a> ) | > [% ELSE %] > You are not logged in | > [% END %] >- <a class="toplinks" href="/cgi-bin/koha/help.pl" id="helper" onclick="var link=window.open('','Koha_Help','width=600,height=600,toolbar=false,scrollbars=yes'); link.location='/cgi-bin/koha/help.pl'; return false;">Help</a> >+ <a class="toplinks" href="/cgi-bin/koha/help.pl" id="helper">Help</a> > </div> > </div> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/js/staff-global.js b/koha-tmpl/intranet-tmpl/prog/en/js/staff-global.js >index 125cd52..f267a0e 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/js/staff-global.js >+++ b/koha-tmpl/intranet-tmpl/prog/en/js/staff-global.js >@@ -1,7 +1,7 @@ > // staff-global.js > if ( KOHA === undefined ) var KOHA = {}; > >-function _(s) { return s } // dummy function for gettext >+function _(s) { return s; } // dummy function for gettext > > $(document).ready(function() { > $('#header_search').tabs().bind('tabsshow', function(e, ui) { $('#header_search > div:not(.ui-tabs-hide)').find('input').eq(0).focus(); }); >@@ -10,9 +10,15 @@ function _(s) { return s } // dummy function for gettext > if($("#header_search #circ_search").length > 0){ $(document).bind('keydown','Alt+u',function (){ $("#header_search").tabs("select","#circ_search"); $("#findborrower").focus(); }); } else { $(document).bind('keydown','Alt+u',function(){ location.href="/cgi-bin/koha/circ/circulation.pl"; }); } > if($("#header_search #catalog_search").length > 0){ $(document).bind('keydown','Alt+q',function (){ $("#header_search").tabs("select","#catalog_search"); $("#search-form").focus(); }); } else { $(document).bind('keydown','Alt+q',function(){ location.href="/cgi-bin/koha/catalogue/search.pl"; }); } > $(".focus").focus(); >+ $("#logout").click(function(){ >+ logOut(); >+ }); >+ $("#helper").click(function(){ >+ openHelp(); >+ return false; >+ }); > }); > >- > YAHOO.util.Event.onContentReady("header", function () { > var oMoremenu = new YAHOO.widget.Menu("moremenu", { zindex: 2 }); > >@@ -48,7 +54,7 @@ function _(s) { return s } // dummy function for gettext > YAHOO.util.Event.onContentReady("changelanguage", function () { > $(".sublangs").each(function(){ > var menuid = $(this).attr("id"); >- var menuid = menuid.replace("show",""); >+ menuid = menuid.replace("show",""); > > var oMenu = new YAHOO.widget.Menu("sub"+menuid, { zindex: 2 }); > function positionoMenu() { >@@ -72,7 +78,7 @@ YAHOO.util.Event.onContentReady("changelanguage", function () { > YAHOO.widget.Overlay.windowResizeEvent.subscribe(positionoMenu); > }); > }); >- >+ > // http://jennifermadden.com/javascript/stringEnterKeyDetector.html > function checkEnter(e){ //e is event object passed from function invocation > var characterCode; // literal character code will be stored in this variable >@@ -95,6 +101,17 @@ function clearHoldFor(){ > $.cookie("holdfor",null, { path: "/", expires: 0 }); > } > >+function logOut(){ >+ if( typeof delBasket == 'function' ){ >+ delBasket('main', true); >+ } >+ clearHoldFor(); >+} >+ >+function openHelp(){ >+ openWindow("/cgi-bin/koha/help.pl","Koha help",600,600); >+} >+ > jQuery.fn.preventDoubleFormSubmit = function() { > jQuery(this).submit(function() { > if (this.beenSubmitted) >-- >1.7.9.5
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 9424
:
14706
|
15101
|
15191
|
18062
|
18358
|
18391
|
18408