From 4ede87d8e931dfc7404db55272ed47ebfa83060a Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Thu, 16 Dec 2010 12:29:51 -0500 Subject: [PATCH] condensed more JS into 1 shared file --- .../web/opac/skin/kcls/xml/common/js_common.xml | 195 +------------------- .../skin/kcls/xml/common/js_common_postbody.xml | 114 +----------- .../web/opac/skin/kcls/xml/common/js_shared.xml | 199 +++++++++++++++++++++ 3 files changed, 206 insertions(+), 302 deletions(-) create mode 100644 Open-ILS/web/opac/skin/kcls/xml/common/js_shared.xml diff --git a/Open-ILS/web/opac/skin/kcls/xml/common/js_common.xml b/Open-ILS/web/opac/skin/kcls/xml/common/js_common.xml index 2d69634e62..8f343cd1b1 100644 --- a/Open-ILS/web/opac/skin/kcls/xml/common/js_common.xml +++ b/Open-ILS/web/opac/skin/kcls/xml/common/js_common.xml @@ -8,102 +8,6 @@ isDebug: false }; var lang, bidi; - - - isFrontPage = true; - - - function config_setup() { - config.ids.searchbar = {}; - config.css.searchbar = {}; - config.ids.searchbar.text = 'search_box'; - config.ids.searchbar.facets = 'facet_box'; - config.ids.searchbar.submit = 'search_submit'; - config.ids.searchbar.type_selector = 'search_type_selector'; - config.ids.searchbar.depth_selector = 'depth_selector'; - config.ids.searchbar.form_selector = 'form_selector'; - config.ids.searchbar.extra_row = 'searchbar_extra'; - config.ids.searchbar.main_row = 'searchbar_main_row'; - config.ids.searchbar.table = 'searchbar_table'; - config.ids.searchbar.location_tag = 'search_location_tag_link'; - config.ids.searchbar.lib_sel_span = 'lib_selector_span'; - config.ids.searchbar.lib_sel_link = 'lib_selector_link'; - config.ids.searchbar.depth_sel_span = 'depth_selector_span'; - config.ids.common.top_logo = "top_left_logo"; - config.ids.sidebar = {}; - config.css.sidebar = {}; - config.names.sidebar = {}; - config.css.sidebar.item = {}; - config.ids.sidebar.home = 'home_link_div'; - config.ids.sidebar.advanced = 'advanced_link_div'; - config.ids.sidebar.myopac = 'myopac_link_div'; - config.ids.sidebar.prefs = 'prefs_link_div'; - config.ids.sidebar.mresult = 'mresult_link_div'; - config.ids.sidebar.rresult = 'result_link_div'; - config.ids.sidebar.rdetail = "rdetail_link_div"; - config.ids.sidebar.login = 'login_link'; - config.ids.sidebar.logout = 'logout_link'; - config.ids.sidebar.logoutbox = 'logout_link_div'; - config.ids.sidebar.loginbox = 'login_link_div'; - config.ids.sidebar.logged_in_as = 'logged_in_as_div'; - config.ids.sidebar.username_dest = 'username_dest'; - - config.ids.sidebar.home_link = 'home_link' - config.ids.sidebar.advanced_link = 'advanced_link' - config.ids.sidebar.myopac_link = 'myopac_link' - - config.css.encircled = 'encircled'; - - config.ids.login = {}; - config.css.login = {}; - config.ids.login.form = "login_form"; - config.ids.login.box = "login_box"; - config.ids.login.tbody = "login_tbody"; - config.ids.login.username = "login_username"; - config.ids.login.password = "login_password"; - config.ids.login.button = "login_button"; - config.ids.login.cancel = "login_cancel_button"; - config.ids.altcanvas.login = config.ids.login.box; - - config.ids.altcanvas.myopac_reload = 'myopac_reloading'; - config.ids.myopac = {}; - config.css.myopac = {}; - config.names.myopac = {}; - - config.ids.altcanvas.org_tree = config.ids.common.org_container; - config.ids.altcanvas.holds = 'holds_box'; - config.ids.altcanvas.check_holds = 'check_holds_box'; - config.ids.altcanvas.xulholds = 'xulholds_box'; - config.ids.altcanvas.loading = 'loading_alt'; - - - config.ids.rdetail = {}; - config.ids.rdetail.view_marc = "rdetail_view_marc"; - config.ids.rdetail.details_body = 'rdetail_details_body'; - config.ids.rdetail.title = 'rdetail_title'; - config.ids.rdetail.author = 'rdetail_author'; - config.ids.rdetail.isbn = 'rdetail_isbn'; - config.ids.rdetail.edition = 'rdetail_edition'; - config.ids.rdetail.pubdate = 'rdetail_pubdate'; - config.ids.rdetail.publisher = 'rdetail_publisher'; - config.ids.rdetail.tor = 'rdetail_tor'; - config.ids.rdetail.abstr = 'rdetail_abstract'; - config.ids.rdetail.image = 'rdetail_image'; - config.ids.rdetail.tor_pic = 'rdetail_tor_pic'; - - config.ids.rdetail.cp_status = "rdetail_copy_info_status"; - config.ids.rdetail.cp_info_row = "rdetail_copy_info_row"; - config.ids.rdetail.cp_info_loading = "rdetail_copy_info_loading"; - config.ids.rdetail.cp_info_local = "copy_info_local_link"; - config.ids.rdetail.cp_info_all = "copy_info_all_link"; - config.ids.rdetail.cp_info_none = "rdetail_copy_info_none"; - config.names.rdetail.lib_cell = "rdetail_library_cell"; - config.names.rdetail.cn_cell = "rdetail_callnumber_cell"; - config.names.rdetail.cp_count_cell = "rdetail_copy_count_cell"; - config.names.rdetail.cp_status = 'rdetail_status_cell'; - - - } ]]> @@ -229,104 +133,9 @@ + diff --git a/Open-ILS/web/opac/skin/kcls/xml/common/js_common_postbody.xml b/Open-ILS/web/opac/skin/kcls/xml/common/js_common_postbody.xml index d8516692e5..074a0488e7 100644 --- a/Open-ILS/web/opac/skin/kcls/xml/common/js_common_postbody.xml +++ b/Open-ILS/web/opac/skin/kcls/xml/common/js_common_postbody.xml @@ -2,50 +2,16 @@ dojo.require('openils.Util'); // set up some global JS config variables, read from the Apache config - var OILS_OPAC_IMAGES_HOST = null; - - OILS_OPAC_IMAGES_HOST = 'extras/ac/jacket/'; - - var OILS_OPAC_STATIC_PROTOCOL = null; - - OILS_OPAC_STATIC_PROTOCOL = ''; - - - var chilifresh = ''; - if (chilifresh == '(none)') { chilifresh = false; } - var novelist = ''; - if (novelist == '(none)') { novelist = false; } - - openils.Util.requireLegacy('/Cookies.js'); - var cookieManager = new HTTP.Cookies(); openils.Util.requireLegacy('/js/dojo/dojo/openils_dojo.js'); openils.Util.requireLegacy('/js/dojo/fieldmapper/AutoIDL.js'); - - dojo.require("dijit._Calendar"); - dojo.require("dijit.form.DateTextBox"); - dojo.require("dijit.form.FilteringSelect"); - dojo.require("dojo.date.locale"); - dojo.require("dojo.date.stamp"); - dojo.require("dojo.parser"); - dojo.require("dojo.cookie"); - dojo.require("dijit.form.CheckBox"); - dojo.require("openils.widget.ProgressDialog"); - dojo.require("openils.widget.FacetSidebar"); // pulls in Searcher and I18N - - openils.Util.requireLegacy('//OrgTree.js'); openils.Util.requireLegacy('//FacetDefs.js'); openils.Util.requireLegacy('/skin/kcls/js/combined.js') - /* - When combined JS is enabled in the Apache config, the block - below defines which files are added to the final combined JS file. - Currently, only files in $OPAC/common/js/ are eligible for automatic combination. - */ - /* START COMPRESSION */ + /* See js_common.xml for which files are actually combined/compressed by autogen */ openils.Util.requireLegacy('/OrgLasso.js'); openils.Util.requireLegacy('/utils.js'); openils.Util.requireLegacy('/config.js'); @@ -58,22 +24,10 @@ openils.Util.requireLegacy('/init.js'); openils.Util.requireLegacy('/added_content.js'); openils.Util.requireLegacy('/DP_DateExtensions.js'); - /* END COMPRESSION */ + openils.Util.requireLegacy('/Cookies.js'); - config_setup(); /* defined in js_common.xml */ - - /* ----------------------------------------------------------------------- - KCLS suppressed orgs - ----------------------------------------------------------------------- */ - var localSuppressedOrgs = {1500:true, 1501:true, 1558:true}; /* change to suit */ - for (var i in orgArraySearcher) { - var org = orgArraySearcher[i]; - if(localSuppressedOrgs[i]) { - org.opac_visible('f'); - } - } - /* ----------------------------------------------------------------------- */ + function skin_init() { openils.Util.requireLegacy('/opac/skin/kcls/js/depth_selector.js'); @@ -107,7 +61,6 @@ /* if rdetail.xml */ - openils.Util.requireLegacy('/skin/kcls/js/myopac.js'); openils.Util.requireLegacy('/skin/kcls/js/container.js'); @@ -134,65 +87,8 @@ openils.Util.requireLegacy('/skin/kcls/js/adv_global.js'); openils.Util.requireLegacy('/skin/kcls/js/sidebar.js'); - - /* I'm not sure how to test for the situation where this block is - needed, but this won't hurt. */ - try { - if ($('holds_frozen_chkbox').checked) - unHideMe($("hold_frozen_thaw_row")); - } catch (E) { - void(0); - } - - try { - document.getElementById('toptable').style.display = 'table'; - } catch(e) { - try { - document.getElementById('toptable').style.display = ''; - } catch(ee) {} - } - - attachEvt("common", "unload", function(){ - if(typeof(G)!="undefined") destroyObj(G); - if(typeof(HTTP)!="undefined") destroyObj(HTTP); - if(typeof(_c)!="undefined") destroyObj(_c); - if(typeof(_l)!="undefined") destroyObj(_l); - if(typeof(config)!="undefined") destroyObj(config); - if(typeof(facet_list)!="undefined") destroyObj(facet_list); - if(typeof(globalOrgTree)!="undefined") destroyObj(globalOrgTree); - if(typeof(globalOrgTypes)!="undefined") destroyObj(globalOrgTypes); - if(typeof(google)!="undefined") destroyObj(google); - if(typeof(orgArraySearcher)!="undefined") destroyObj(orgArraySearcher); - if(typeof(recordsCache)!="undefined") destroyObj(recordsCache); - if(typeof(search_list)!="undefined") destroyObj(search_list); - if(typeof(subjectCache)!="undefined") destroyObj(subjectCache); - if(typeof(xrefCacheIndex)!="undefined") destroyObj(xrefCacheIndex); - if(typeof(x)!="undefined") destroyObj(x); - if(typeof(string)!="undefined") string = ""; - //removeChildren(document); - //alert(errCounter+'\n'+errCounter2); - }); } - /* google analytics */ - var _gaq = _gaq || []; - _gaq.push(['_setAccount', 'UA-3018520-10']); - _gaq.push(['_trackPageview']); - - (function() { - var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; - ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; - var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); - })(); - - dojo.addOnLoad( - function() { - skin_init(); - - isFrontPage = true; - - init(); - opac_init(); - } - ); + dojo.addOnLoad( function() { skin_init(); init(); opac_init(); }); + ]]> diff --git a/Open-ILS/web/opac/skin/kcls/xml/common/js_shared.xml b/Open-ILS/web/opac/skin/kcls/xml/common/js_shared.xml new file mode 100644 index 0000000000..179623515e --- /dev/null +++ b/Open-ILS/web/opac/skin/kcls/xml/common/js_shared.xml @@ -0,0 +1,199 @@ + +isFrontPage = true; + + +config.ids.searchbar = {}; +config.css.searchbar = {}; +config.ids.searchbar.text = 'search_box'; +config.ids.searchbar.facets = 'facet_box'; +config.ids.searchbar.submit = 'search_submit'; +config.ids.searchbar.type_selector = 'search_type_selector'; +config.ids.searchbar.depth_selector = 'depth_selector'; +config.ids.searchbar.form_selector = 'form_selector'; +config.ids.searchbar.extra_row = 'searchbar_extra'; +config.ids.searchbar.main_row = 'searchbar_main_row'; +config.ids.searchbar.table = 'searchbar_table'; +config.ids.searchbar.location_tag = 'search_location_tag_link'; +config.ids.searchbar.lib_sel_span = 'lib_selector_span'; +config.ids.searchbar.lib_sel_link = 'lib_selector_link'; +config.ids.searchbar.depth_sel_span = 'depth_selector_span'; +config.ids.common.top_logo = "top_left_logo"; +config.ids.sidebar = {}; +config.css.sidebar = {}; +config.names.sidebar = {}; +config.css.sidebar.item = {}; +config.ids.sidebar.home = 'home_link_div'; +config.ids.sidebar.advanced = 'advanced_link_div'; +config.ids.sidebar.myopac = 'myopac_link_div'; +config.ids.sidebar.prefs = 'prefs_link_div'; +config.ids.sidebar.mresult = 'mresult_link_div'; +config.ids.sidebar.rresult = 'result_link_div'; +config.ids.sidebar.rdetail = "rdetail_link_div"; +config.ids.sidebar.login = 'login_link'; +config.ids.sidebar.logout = 'logout_link'; +config.ids.sidebar.logoutbox = 'logout_link_div'; +config.ids.sidebar.loginbox = 'login_link_div'; +config.ids.sidebar.logged_in_as = 'logged_in_as_div'; +config.ids.sidebar.username_dest = 'username_dest'; + +config.ids.sidebar.home_link = 'home_link' +config.ids.sidebar.advanced_link = 'advanced_link' +config.ids.sidebar.myopac_link = 'myopac_link' + +config.css.encircled = 'encircled'; + +config.ids.login = {}; +config.css.login = {}; +config.ids.login.form = "login_form"; +config.ids.login.box = "login_box"; +config.ids.login.tbody = "login_tbody"; +config.ids.login.username = "login_username"; +config.ids.login.password = "login_password"; +config.ids.login.button = "login_button"; +config.ids.login.cancel = "login_cancel_button"; +config.ids.altcanvas.login = config.ids.login.box; + +config.ids.altcanvas.myopac_reload = 'myopac_reloading'; +config.ids.myopac = {}; +config.css.myopac = {}; +config.names.myopac = {}; + +config.ids.altcanvas.org_tree = config.ids.common.org_container; +config.ids.altcanvas.holds = 'holds_box'; +config.ids.altcanvas.check_holds = 'check_holds_box'; +config.ids.altcanvas.xulholds = 'xulholds_box'; +config.ids.altcanvas.loading = 'loading_alt'; + + +config.ids.rdetail = {}; +config.ids.rdetail.view_marc = "rdetail_view_marc"; +config.ids.rdetail.details_body = 'rdetail_details_body'; +config.ids.rdetail.title = 'rdetail_title'; +config.ids.rdetail.author = 'rdetail_author'; +config.ids.rdetail.isbn = 'rdetail_isbn'; +config.ids.rdetail.edition = 'rdetail_edition'; +config.ids.rdetail.pubdate = 'rdetail_pubdate'; +config.ids.rdetail.publisher = 'rdetail_publisher'; +config.ids.rdetail.tor = 'rdetail_tor'; +config.ids.rdetail.abstr = 'rdetail_abstract'; +config.ids.rdetail.image = 'rdetail_image'; +config.ids.rdetail.tor_pic = 'rdetail_tor_pic'; + +config.ids.rdetail.cp_status = "rdetail_copy_info_status"; +config.ids.rdetail.cp_info_row = "rdetail_copy_info_row"; +config.ids.rdetail.cp_info_loading = "rdetail_copy_info_loading"; +config.ids.rdetail.cp_info_local = "copy_info_local_link"; +config.ids.rdetail.cp_info_all = "copy_info_all_link"; +config.ids.rdetail.cp_info_none = "rdetail_copy_info_none"; +config.names.rdetail.lib_cell = "rdetail_library_cell"; +config.names.rdetail.cn_cell = "rdetail_callnumber_cell"; +config.names.rdetail.cp_count_cell = "rdetail_copy_count_cell"; +config.names.rdetail.cp_status = 'rdetail_status_cell'; + + + +var OILS_OPAC_IMAGES_HOST = null; + + OILS_OPAC_IMAGES_HOST = 'extras/ac/jacket/'; + +var OILS_OPAC_STATIC_PROTOCOL = null; + + OILS_OPAC_STATIC_PROTOCOL = ''; + + +var chilifresh = ''; +if (chilifresh == '(none)') { chilifresh = false; } +var novelist = ''; +if (novelist == '(none)') { novelist = false; } + + +var cookieManager = new HTTP.Cookies(); + +/* ----------------------------------------------------------------------- + KCLS suppressed orgs + ----------------------------------------------------------------------- */ +var localSuppressedOrgs = {1500:true, 1501:true, 1558:true}; /* change to suit */ +for (var i in orgArraySearcher) { + var org = orgArraySearcher[i]; + if(localSuppressedOrgs[i]) { + org.opac_visible('f'); + } +} +/* ----------------------------------------------------------------------- */ + + + forceLoginSSL = true; + + + +/* I'm not sure how to test for the situation where this block is + needed, but this won't hurt. */ +try { + if ($('holds_frozen_chkbox').checked) + unHideMe($("hold_frozen_thaw_row")); +} catch (E) { + void(0); +} + +dojo.require('dojo.cookie'); +dojo.require("dijit._Calendar"); +dojo.require("dijit.form.DateTextBox"); +dojo.require("dijit.form.FilteringSelect"); +dojo.require("dojo.date.locale"); +dojo.require("dojo.date.stamp"); +dojo.require("dojo.parser"); +dojo.require("openils.widget.FacetSidebar"); // pulls in Searcher and I18N +dojo.require("dijit.form.CheckBox"); +dojo.require("openils.widget.ProgressDialog"); + + +dojo.addOnLoad( + function() { + setTimeout( + function() { + attachEvt("common", "unload", function(){ + if(typeof(G)!="undefined") destroyObj(G); + if(typeof(HTTP)!="undefined") destroyObj(HTTP); + if(typeof(_c)!="undefined") destroyObj(_c); + if(typeof(_l)!="undefined") destroyObj(_l); + if(typeof(config)!="undefined") destroyObj(config); + if(typeof(facet_list)!="undefined") destroyObj(facet_list); + if(typeof(globalOrgTree)!="undefined") destroyObj(globalOrgTree); + if(typeof(globalOrgTypes)!="undefined") destroyObj(globalOrgTypes); + if(typeof(google)!="undefined") destroyObj(google); + if(typeof(orgArraySearcher)!="undefined") destroyObj(orgArraySearcher); + if(typeof(recordsCache)!="undefined") destroyObj(recordsCache); + if(typeof(search_list)!="undefined") destroyObj(search_list); + if(typeof(subjectCache)!="undefined") destroyObj(subjectCache); + if(typeof(xrefCacheIndex)!="undefined") destroyObj(xrefCacheIndex); + if(typeof(x)!="undefined") destroyObj(x); + if(typeof(string)!="undefined") string = ""; + //removeChildren(document); + //alert(errCounter+'\n'+errCounter2); + }); + }, 0 + ) + } +); + + +/* google analytics ------------------------------------------ */ +var _gaq = _gaq || []; +_gaq.push(['_setAccount', 'UA-3018520-10']); +_gaq.push(['_trackPageview']); + +(function() { + var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; + ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; + var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); +})(); +/* google analytics ------------------------------------------ */ + +try { + document.getElementById('toptable').style.display = 'table'; +} catch(e) { + try { + document.getElementById('toptable').style.display = ''; + } catch(ee) {} +} + -- 2.11.0