diff options
author | Alvin Li <liweitianux@gmail.com> | 2013-08-22 15:18:58 +0800 |
---|---|---|
committer | Alvin Li <liweitianux@gmail.com> | 2013-08-22 15:18:58 +0800 |
commit | 3f1d09f3b5b86157ccf9f47eef69a065be6153a4 (patch) | |
tree | 84d424db169cea7daff7dc2ed7e045de15ec86eb /97suifangqa/apps/indicator/static/plugins/thickbox | |
parent | 3ef1e03e4273544cce177ce7fa0e0ab75eded990 (diff) | |
download | 97dev-3f1d09f3b5b86157ccf9f47eef69a065be6153a4.tar.bz2 |
* 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
Diffstat (limited to '97suifangqa/apps/indicator/static/plugins/thickbox')
-rw-r--r-- | 97suifangqa/apps/indicator/static/plugins/thickbox/README | 20 | ||||
-rw-r--r-- | 97suifangqa/apps/indicator/static/plugins/thickbox/VERSION_2.0 | 0 | ||||
-rw-r--r-- | 97suifangqa/apps/indicator/static/plugins/thickbox/images/loadingAnimation2.gif | bin | 0 -> 5886 bytes | |||
-rw-r--r-- | 97suifangqa/apps/indicator/static/plugins/thickbox/images/macFFBgHack.png | bin | 0 -> 207 bytes | |||
-rw-r--r-- | 97suifangqa/apps/indicator/static/plugins/thickbox/thickbox.js | 60 |
5 files changed, 66 insertions, 14 deletions
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: + +<script type="text/javascript" src="path-to-file/jquery.js"></script> +<script type="text/javascript" src="path-to-file/thickbox.js"></script> + +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: + +<link rel="stylesheet" href="path-to-file/thickbox.css" type="text/css" media="screen" /> + +Or + +<style type="text/css" media="all">@import "path-to-file/thickbox.css";</style> + +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 --- /dev/null +++ b/97suifangqa/apps/indicator/static/plugins/thickbox/VERSION_2.0 diff --git a/97suifangqa/apps/indicator/static/plugins/thickbox/images/loadingAnimation2.gif b/97suifangqa/apps/indicator/static/plugins/thickbox/images/loadingAnimation2.gif Binary files differnew file mode 100644 index 0000000..82290f4 --- /dev/null +++ b/97suifangqa/apps/indicator/static/plugins/thickbox/images/loadingAnimation2.gif diff --git a/97suifangqa/apps/indicator/static/plugins/thickbox/images/macFFBgHack.png b/97suifangqa/apps/indicator/static/plugins/thickbox/images/macFFBgHack.png Binary files differnew file mode 100644 index 0000000..c6473b3 --- /dev/null +++ b/97suifangqa/apps/indicator/static/plugins/thickbox/images/macFFBgHack.png 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("<div id='TB_load' class='loadingAnimation'></div>"); + $("body").append("<div id='TB_load' class='loadingAnimation'><img src='"+imgLoader.src+"' /></div>"); 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("<div id='TB_title'><div id='TB_ajaxWindowTitle'>"+caption+"</div><div id='TB_closeAjaxWindow'><a href='#' id='TB_closeWindowButton'>close</a></div></div>"); 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("<iframe frameborder='no' marginheight='0' marginwidth='0' border='0' src='"+urlNoQuery+"' id='TB_iframeContent' style='width:"+(ajaxContentW)+"px;height:"+(ajaxContentH)+"px;'></iframe>"); + $("#TB_window").append("<iframe frameborder='no' marginheight='0' marginwidth='0' border='0' src='"+urlNoTBQuery[0]+"' id='TB_iframeContent' style='width:"+(ajaxContentW)+"px;height:"+(ajaxContentH)+"px;'></iframe>"); }else{ $("#TB_window").append("<div id='TB_ajaxContent' style='width:"+ajaxContentW+"px;height:"+ajaxContentH+"px;'></div>"); } @@ -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: // |