Bug 1090727: support jquery in the global/header template, and update the header and footer to use jquery

r=glob,a=glob


git-svn-id: svn://10.0.0.236/trunk@265674 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
bzrmirror%bugzilla.org
2014-11-17 15:15:59 +00:00
parent fbce1c42e1
commit 5cb740a97a
24 changed files with 146 additions and 78 deletions

View File

@@ -1 +1 @@
9208
9209

View File

@@ -1 +1 @@
11c2093850773b1c39ebecec47c2a940f5105e70
a50e8fd42e682ac115792677104a467445a1c0ad

View File

@@ -7,54 +7,35 @@
*/
function show_mini_login_form( suffix ) {
var login_link = document.getElementById('login_link' + suffix);
var login_form = document.getElementById('mini_login' + suffix);
var account_container = document.getElementById('new_account_container'
+ suffix);
YAHOO.util.Dom.addClass(login_link, 'bz_default_hidden');
YAHOO.util.Dom.removeClass(login_form, 'bz_default_hidden');
YAHOO.util.Dom.addClass(account_container, 'bz_default_hidden');
$('#login_link' + suffix).addClass('bz_default_hidden');
$('#mini_login' + suffix).removeClass('bz_default_hidden');
$('#new_account_container' + suffix).addClass('bz_default_hidden');
return false;
}
function hide_mini_login_form( suffix ) {
var login_link = document.getElementById('login_link' + suffix);
var login_form = document.getElementById('mini_login' + suffix);
var account_container = document.getElementById('new_account_container'
+ suffix);
YAHOO.util.Dom.removeClass(login_link, 'bz_default_hidden');
YAHOO.util.Dom.addClass(login_form, 'bz_default_hidden');
YAHOO.util.Dom.removeClass(account_container, 'bz_default_hidden');
$('#login_link' + suffix).removeClass('bz_default_hidden');
$('#mini_login' + suffix).addClass('bz_default_hidden');
$('#new_account_container' + suffix).removeClass('bz_default_hidden');
return false;
}
function show_forgot_form( suffix ) {
var forgot_link = document.getElementById('forgot_link' + suffix);
var forgot_form = document.getElementById('forgot_form' + suffix);
var login_container = document.getElementById('mini_login_container'
+ suffix);
YAHOO.util.Dom.addClass(forgot_link, 'bz_default_hidden');
YAHOO.util.Dom.removeClass(forgot_form, 'bz_default_hidden');
YAHOO.util.Dom.addClass(login_container, 'bz_default_hidden');
$('#forgot_link' + suffix).addClass('bz_default_hidden');
$('#forgot_form' + suffix).removeClass('bz_default_hidden');
$('#login_container' + suffix).addClass('bz_default_hidden');
return false;
}
function hide_forgot_form( suffix ) {
var forgot_link = document.getElementById('forgot_link' + suffix);
var forgot_form = document.getElementById('forgot_form' + suffix);
var login_container = document.getElementById('mini_login_container'
+ suffix);
YAHOO.util.Dom.removeClass(forgot_link, 'bz_default_hidden');
YAHOO.util.Dom.addClass(forgot_form, 'bz_default_hidden');
YAHOO.util.Dom.removeClass(login_container, 'bz_default_hidden');
$('#forgot_link' + suffix).removeClass('bz_default_hidden');
$('#forgot_form' + suffix).addClass('bz_default_hidden');
$('#login_container' + suffix).removeClass('bz_default_hidden');
return false;
}
function set_language( value ) {
YAHOO.util.Cookie.set('LANG', value,
{
$.cookie('LANG', value, {
expires: new Date('January 1, 2038'),
path: BUGZILLA.param.cookie_path
});

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,19 @@
/*!
* jQuery Cookie Plugin v1.4.1
* https://github.com/carhartl/jquery-cookie
*
* Copyright 2013 Klaus Hartl
* Released under the MIT license
*/
(function(factory){if(typeof define==='function'&&define.amd){define(['jquery'],factory);}else if(typeof exports==='object'){factory(require('jquery'));}else{factory(jQuery);}}(function($){var pluses=/\+/g;function encode(s){return config.raw?s:encodeURIComponent(s);}
function decode(s){return config.raw?s:decodeURIComponent(s);}
function stringifyCookieValue(value){return encode(config.json?JSON.stringify(value):String(value));}
function parseCookieValue(s){if(s.indexOf('"')===0){s=s.slice(1,-1).replace(/\\"/g,'"').replace(/\\\\/g,'\\');}
try{s=decodeURIComponent(s.replace(pluses,' '));return config.json?JSON.parse(s):s;}catch(e){}}
function read(s,converter){var value=config.raw?s:parseCookieValue(s);return $.isFunction(converter)?converter(value):value;}
var config=$.cookie=function(key,value,options){if(value!==undefined&&!$.isFunction(value)){options=$.extend({},config.defaults,options);if(typeof options.expires==='number'){var days=options.expires,t=options.expires=new Date();t.setTime(+t+days*864e+5);}
return(document.cookie=[encode(key),'=',stringifyCookieValue(value),options.expires?'; expires='+options.expires.toUTCString():'',options.path?'; path='+options.path:'',options.domain?'; domain='+options.domain:'',options.secure?'; secure':''].join(''));}
var result=key?undefined:{};var cookies=document.cookie?document.cookie.split('; '):[];for(var i=0,l=cookies.length;i<l;i++){var parts=cookies[i].split('=');var name=decode(parts.shift());var cookie=parts.join('=');if(key&&key===name){result=read(cookie,value);break;}
if(!key&&(cookie=read(cookie))!==undefined){result[name]=cookie;}}
return result;};config.defaults={};$.removeCookie=function(key,options){if($.cookie(key)===undefined){return false;}
$.cookie(key,'',$.extend({},options,{expires:-1}));return!$.cookie(key);};}));

Binary file not shown.

After

Width:  |  Height:  |  Size: 418 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 312 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 205 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 262 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 348 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 207 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 278 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 328 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.2 KiB

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -32,39 +32,60 @@
onload = ""
style_urls = []
yui = []
yui_css = {}
yui_deps = {}
no_yui = 0
jquery = []
jquery_css = []
%]
[% SET yui_css = {
autocomplete => 1,
calendar => 1,
datatable => 1,
button => 1,
} %]
[% IF NOT no_yui %]
[% SET yui_css = {
autocomplete => 1,
calendar => 1,
datatable => 1,
button => 1,
} %]
[%# Note: This is simple dependency resolution--you can't have dependencies
# that depend on each other. You have to specify all of a module's deps,
# if that module is going to be specified in "yui".
#%]
[% SET yui_deps = {
autocomplete => ['json', 'connection', 'datasource'],
datatable => ['json', 'connection', 'datasource', 'element'],
} %]
[%# Note: This is simple dependency resolution--you can't have dependencies
# that depend on each other. You have to specify all of a module's deps,
# if that module is going to be specified in "yui".
#%]
[% SET yui_deps = {
autocomplete => ['json', 'connection', 'datasource'],
datatable => ['json', 'connection', 'datasource', 'element'],
} %]
[%# When using certain YUI modules, we need to process certain
# extra JS templates.
#%]
[% SET yui_templates = {
datatable => ['global/value-descs.js.tmpl'],
} %]
[%# When using certain YUI modules, we need to process certain
# extra JS templates.
#%]
[% SET yui_templates = {
datatable => ['global/value-descs.js.tmpl'],
} %]
[% END %]
[%# These are JS URLs that are *always* on the page and come before
# every other JS URL.
#%]
[% SET starting_js_urls = [
"js/yui/yahoo-dom-event/yahoo-dom-event.js",
"js/yui/cookie/cookie-min.js",
"js/jquery/jquery-min.js",
"js/jquery/ui/jquery-ui-min.js"
] %]
[% IF NOT no_yui %]
[% starting_js_urls.push("js/yui/yahoo-dom-event/yahoo-dom-event.js",
"js/yui/cookie/cookie-min.js") %]
[% END %]
[% SET jq_css_urls = [
"js/jquery/ui/jquery-ui-min.css",
"js/jquery/ui/jquery-ui-structure-min.css",
"js/jquery/ui/jquery-ui-theme-min.css",
] %]
[% undef = style_urls.import(jquery_css, jq_css_urls) %]
[%# Add jQuery cookie support %]
[% jquery.push("cookie") %]
[%# We should be able to set the default value of the header variable
# to the value of the title variable using the DEFAULT directive,
@@ -85,7 +106,9 @@
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
[% END %]
[% SET yui = yui_resolve_deps(yui, yui_deps) %]
[% IF NOT no_yui %]
[% SET yui = yui_resolve_deps(yui, yui_deps) %]
[% END %]
[% SET css_sets = css_files(style_urls, yui, yui_css) %]
[% IF constants.CONCATENATE_ASSETS %]
@@ -115,9 +138,16 @@
[% END %]
[% END %]
[%# YUI Scripts %]
[% FOREACH yui_name = yui %]
[% starting_js_urls.push("js/yui/$yui_name/${yui_name}-min.js") %]
[% IF NOT no_yui %]
[%# YUI Scripts %]
[% FOREACH yui_name = yui %]
[% starting_js_urls.push("js/yui/$yui_name/${yui_name}-min.js") %]
[% END %]
[% END %]
[%# jQuery Plugins %]
[% FOREACH jq_name = jquery %]
[% starting_js_urls.push("js/jquery/plugins/$jq_name/${jq_name}-min.js") %]
[% END %]
[% starting_js_urls.push('js/global.js') %]
@@ -127,27 +157,28 @@
<script type="text/javascript">
<!--
YAHOO.namespace('bugzilla');
YAHOO.util.Event.addListener = function (el, sType, fn, obj, overrideContext) {
if ( ("onpagehide" in window || YAHOO.env.ua.gecko) && sType === "unload") { sType = "pagehide"; };
var capture = ((sType == "focusin" || sType == "focusout") && !YAHOO.env.ua.ie) ? true : false;
return this._addListener(el, this._getType(sType), fn, obj, overrideContext, capture);
};
if ( "onpagehide" in window || YAHOO.env.ua.gecko) {
YAHOO.util.Event._simpleRemove(window, "unload",
YAHOO.util.Event._unload);
}
[% IF NOT no_yui %]
YAHOO.namespace('bugzilla');
YAHOO.util.Event.addListener = function (el, sType, fn, obj, overrideContext) {
if ( ("onpagehide" in window || YAHOO.env.ua.gecko) && sType === "unload") { sType = "pagehide"; };
var capture = ((sType == "focusin" || sType == "focusout") && !YAHOO.env.ua.ie) ? true : false;
return this._addListener(el, this._getType(sType), fn, obj, overrideContext, capture);
};
if ( "onpagehide" in window || YAHOO.env.ua.gecko) {
YAHOO.util.Event._simpleRemove(window, "unload",
YAHOO.util.Event._unload);
}
[% END %]
[%# The language selector needs javascript to set its cookie,
# so it is hidden in HTML/CSS by the "bz_default_hidden" class.
# If the browser can run javascript, it will then "unhide"
# the language selector using the following code.
#%]
function unhide_language_selector() {
YAHOO.util.Dom.removeClass(
'lang_links_container', 'bz_default_hidden'
);
function unhide_language_selector() {
$('#lang_links_container').removeClass('bz_default_hidden');
}
YAHOO.util.Event.onDOMReady(unhide_language_selector);
$(document).ready(unhide_language_selector);
[%# Make some Bugzilla information available to all scripts.
# We don't import every parameter and constant because we
@@ -180,11 +211,14 @@
[% END %]
};
[% FOREACH yui_name = yui %]
[% FOREACH yui_template = yui_templates.$yui_name %]
[% INCLUDE $yui_template %]
[% IF NOT no_yui %]
[% FOREACH yui_name = yui %]
[% FOREACH yui_template = yui_templates.$yui_name %]
[% INCLUDE $yui_template %]
[% END %]
[% END %]
[% END %]
[% IF javascript %]
[% javascript %]
[% END %]