From 3f1d09f3b5b86157ccf9f47eef69a065be6153a4 Mon Sep 17 00:00:00 2001 From: Alvin Li Date: Thu, 22 Aug 2013 15:18:58 +0800 Subject: * added latest full package of 'jquery-ui' plugin, v1.10.3; * improved 'thickbox' plugin to use 'jquery-1.9.x'; * upgraded 'SheetDefault.html', 'NewDeleteIndex.html' and other pages to use 'jquery-1.9.x'; * improved 'IndexDesc.html' to deal with the problem of no related annotation found; * 'indicator.tools.get_record()' added param 'number', and updated the format of return data; * added 'get_num_record()' and 'get_num_record_std()' to 'indicator.tools'; * improved 'indicator.views.ajax_get_card_data_chart()', now can get data by 'num' or by 'date'; * improved 'indicator.views.ajax_get_card_data_table()', to provide the needed data requested from 'detail_card'; * improved js function 'chart_getdata_draw()' in 'SheetDefault.html'; * 'card_chart.js': renamed 'redraw_chart()' to 'detail_chart_getdata_draw()', and updated to get data by type; * updated 'table' of 'detail_card' in 'SheetDefault.html'; * improved js function 'get_card_data_table()' for providing and displaying record data in 'detail_card' table. TODO: * add/delete/edit record data --- .../apps/indicator/static/plugins/thickbox/README | 20 +++++++ .../indicator/static/plugins/thickbox/VERSION_2.0 | 0 .../plugins/thickbox/images/loadingAnimation2.gif | Bin 0 -> 5886 bytes .../static/plugins/thickbox/images/macFFBgHack.png | Bin 0 -> 207 bytes .../indicator/static/plugins/thickbox/thickbox.js | 60 ++++++++++++++++----- 5 files changed, 66 insertions(+), 14 deletions(-) create mode 100644 97suifangqa/apps/indicator/static/plugins/thickbox/README create mode 100644 97suifangqa/apps/indicator/static/plugins/thickbox/VERSION_2.0 create mode 100644 97suifangqa/apps/indicator/static/plugins/thickbox/images/loadingAnimation2.gif create mode 100644 97suifangqa/apps/indicator/static/plugins/thickbox/images/macFFBgHack.png (limited to '97suifangqa/apps/indicator/static/plugins/thickbox') diff --git a/97suifangqa/apps/indicator/static/plugins/thickbox/README b/97suifangqa/apps/indicator/static/plugins/thickbox/README new file mode 100644 index 0000000..b829acb --- /dev/null +++ b/97suifangqa/apps/indicator/static/plugins/thickbox/README @@ -0,0 +1,20 @@ +Before you can implement ThickBox make sure the page that invokes ThickBox has a valid DTD. This is required for ThickBox to look and function correctly. + +1. ThickBox requires the jQuery JavaScript library; because of this, you will need to include the jquery.js file in the head element of your web page, followed by the thickbox.js file (NOTE: jquery.js must come first in the source order). Example below: + + + + +Once you have included the .js files, open thickbox.js or thickbox-compressed.js and locate the tb_pathToImage variable at the top of the page. Once you have found it, make sure to change the value of tb_pathToImage to the path where the loadingAnimation.gif file is located on your own server. + +2. Include the ThickBox CSS file in your web page. As of version 3.1 you will also need to update the path to the macFFBgHack.png in the thickbox.css file. Example options below: + + + +Or + + + +Or, open the thickbox.css file and copy and paste the styles into an existing style sheet. Be aware that the ThickBox CSS file will remove the browsers default padding and margin for all elements. + +3. View the examples to learn the many different ways to use and invoke ThickBox functionality. \ No newline at end of file diff --git a/97suifangqa/apps/indicator/static/plugins/thickbox/VERSION_2.0 b/97suifangqa/apps/indicator/static/plugins/thickbox/VERSION_2.0 new file mode 100644 index 0000000..e69de29 diff --git a/97suifangqa/apps/indicator/static/plugins/thickbox/images/loadingAnimation2.gif b/97suifangqa/apps/indicator/static/plugins/thickbox/images/loadingAnimation2.gif new file mode 100644 index 0000000..82290f4 Binary files /dev/null and b/97suifangqa/apps/indicator/static/plugins/thickbox/images/loadingAnimation2.gif differ diff --git a/97suifangqa/apps/indicator/static/plugins/thickbox/images/macFFBgHack.png b/97suifangqa/apps/indicator/static/plugins/thickbox/images/macFFBgHack.png new file mode 100644 index 0000000..c6473b3 Binary files /dev/null and b/97suifangqa/apps/indicator/static/plugins/thickbox/images/macFFBgHack.png differ diff --git a/97suifangqa/apps/indicator/static/plugins/thickbox/thickbox.js b/97suifangqa/apps/indicator/static/plugins/thickbox/thickbox.js index 81448bd..9b6fb06 100644 --- a/97suifangqa/apps/indicator/static/plugins/thickbox/thickbox.js +++ b/97suifangqa/apps/indicator/static/plugins/thickbox/thickbox.js @@ -8,17 +8,35 @@ */ //on page load call TB_init -$(document).ready(TB_init); +$(document).ready(function() { + // set loadingAnimation image + if (typeof parent.thickbox_loading_image !== 'undefined') { + tb_pathToImage = parent.thickbox_loading_image; + } + else if (typeof parent.static_url !== 'undefined') { + tb_pathToImage = parent.static_url + "images/loadingAnimation.gif"; + } + else { + tb_pathToImage = "images/loadingAnimation.gif"; + } + //console.log("tb_pathToImage: ", tb_pathToImage); + imgLoader = new Image();// preload image + imgLoader.src = tb_pathToImage; + // init + TB_init(); +}); //add thickbox to href elements that have a class of .thickbox function TB_init(){ - $("a.thickbox").live("click", function(){ + //$("a.thickbox").live("click", function(){ + // '.live()' removed in jQuery 1.9 + $(document).on("click", "a.thickbox", function(){ if(this.href == 'javascript:void(0)'){ return false; } var t = this.title || this.name || null; var g = this.rel || false; - TB_show(t,this.href,g); + TB_show(t, this.href, g); this.blur(); return false; }); @@ -37,12 +55,23 @@ function TB_show(caption, url, imageGroup) {//function called when the user clic TB_overlaySize(); - $("body").append("
"); + $("body").append("
"); TB_load_position(); var urlString = /\.jpg|\.jpeg|\.png|\.gif|\.html|\.htm|\.php|\.cfm|\.asp|\.aspx|\.jsp|\.jst|\.rb|\.txt|\.bmp/g; var urlType = url.toLowerCase().match(urlString); - + + // check 'url_type' query param + // django url does not have '.xxx' extensions + var queryString = url.replace(/^[^\?]+\??/,''); + var params = TB_parseQuery( queryString ); + //console.log("params['url_type']: ", params['url_type']); + var _undefined_; // local undefined + if (params['url_type'] !== _undefined_ && params['url_type'] !== '') { + urlType = params['url_type']; + } + //console.log('urlType: ', urlType); + if(urlType == '.jpg' || urlType == '.jpeg' || urlType == '.png' || urlType == '.gif' || urlType == '.bmp'){//code to show images TB_PrevCaption = ""; @@ -155,27 +184,28 @@ function TB_show(caption, url, imageGroup) {//function called when the user clic //console.log(queryString); //console.log(params); - TB_WIDTH = (params['width']*1) + 30 || 630; - TB_HEIGHT = (params['height']*1) + 40 || 440; - ajaxContentW = TB_WIDTH - 30; - ajaxContentH = TB_HEIGHT - 45; + //TB_WIDTH = (params['width']*1) + 30 || 630; + //TB_HEIGHT = (params['height']*1) + 40 || 440; + //ajaxContentW = TB_WIDTH - 30; + //ajaxContentH = TB_HEIGHT - 45; TB_WIDTH = (params['width']*1); TB_HEIGHT = (params['height']*1); ajaxContentW = TB_WIDTH; ajaxContentH = TB_HEIGHT; //console.log(url); - if(url.indexOf('no_title') != -1){ + if(params['no_title'] != "true"){ $("#TB_window").append("
"+caption+"
"); TB_HEIGHT += 27; //title height } if(url.indexOf('TB_iframe') != -1){ if(url.indexOf('transfer_params') == -1){ urlNoQuery = url.substr(0,TB_strpos(url, "?")); + urlNoTBQuery = url.split('TB_'); }else{ urlNoQuery = url; } - $("#TB_window").append(""); + $("#TB_window").append(""); }else{ $("#TB_window").append("
"); } @@ -282,8 +312,10 @@ function TB_getPageSize(){ } function TB_strpos(str, ch) { -for (var i = 0; i < str.length; i++) -if (str.substring(i, i+1) == ch) return i; -return -1; + for (var i = 0; i < str.length; i++) { + if (str.substring(i, i+1) == ch) return i; + } + return -1; } +// vim: set ts=4 sw=4 tw=0 fenc=utf-8 ft=javascript: // -- cgit v1.2.2