|
From: <ma...@us...> - 2013-02-02 17:00:31
|
Revision: 1387
http://openautomation.svn.sourceforge.net/openautomation/?rev=1387&view=rev
Author: mayerch
Date: 2013-02-02 17:00:22 +0000 (Sat, 02 Feb 2013)
Log Message:
-----------
Make more files (esp. the CSS) preventing the cache when the URL parameter forceReload is set to true
Modified Paths:
--------------
CometVisu/trunk/visu/index.html
CometVisu/trunk/visu/lib/compatibility.js
CometVisu/trunk/visu/lib/templateengine.js
CometVisu/trunk/visu/plugins/colorchooser/structure_plugin.js
CometVisu/trunk/visu/plugins/diagram/structure_plugin.js
Modified: CometVisu/trunk/visu/index.html
===================================================================
--- CometVisu/trunk/visu/index.html 2013-02-02 14:05:53 UTC (rev 1386)
+++ CometVisu/trunk/visu/index.html 2013-02-02 17:00:22 UTC (rev 1387)
@@ -16,7 +16,7 @@
<script src="dependencies/jquery.js" type="text/javascript"></script>
<script src="lib/compatibility.js" type="text/javascript"></script>
<script type="text/javascript">
- $.ajaxSetup({ crossDomain: true }); // make scripts debugable
+ $.ajaxSetup({ crossDomain: true, cache: 'true' != $.getUrlVar('forceReload') }); // make scripts debugable
$.getOrderedScripts([
"dependencies/jquery-ui.js",
"dependencies/strftime.js",
Modified: CometVisu/trunk/visu/lib/compatibility.js
===================================================================
--- CometVisu/trunk/visu/lib/compatibility.js 2013-02-02 14:05:53 UTC (rev 1386)
+++ CometVisu/trunk/visu/lib/compatibility.js 2013-02-02 17:00:22 UTC (rev 1387)
@@ -163,5 +163,15 @@
? function(){ $.getOrderedScripts(files, callback);}
: callback
);
+ },
+ // inspired by http://stackoverflow.com/questions/2685614/load-external-css-file-like-scripts-in-jquery-which-is-compatible-in-ie-also
+ getCSS: function( url, parameters ) {
+ var cssLink = $( '<link/>' );
+ $( 'head' ).append( cssLink ); //IE hack: append before setting href
+ cssLink.attr( $.extend( parameters, {
+ rel: "stylesheet",
+ type: "text/css",
+ href: $.ajaxSettings.cache ? url : url + '?_=' + (new Date()).valueOf()
+ }) );
}
});
\ No newline at end of file
Modified: CometVisu/trunk/visu/lib/templateengine.js
===================================================================
--- CometVisu/trunk/visu/lib/templateengine.js 2013-02-02 14:05:53 UTC (rev 1386)
+++ CometVisu/trunk/visu/lib/templateengine.js 2013-02-02 17:00:22 UTC (rev 1387)
@@ -287,9 +287,11 @@
this.parseXML = function(xml) {
// erst mal den Cache für AJAX-Requests wieder aktivieren
+ /*
$.ajaxSetup({
cache : true
});
+ */
/*
* First, we try to get a design by url Secondly, we try to get a predefined
@@ -332,19 +334,12 @@
}
var maxMobileScreenWidth = $('pages', xml).attr('max_mobile_screen_width') || 480;
- $('head')
- .append(
- '<link rel="stylesheet" type="text/css" href="designs/designglobals.css" />');
- $('head').append(
- '<link rel="stylesheet" type="text/css" href="designs/' + thisTemplateEngine.clientDesign
- + '/basic.css" />');
- $('head').append(
- '<link rel="stylesheet" type="text/css" href="designs/' + thisTemplateEngine.clientDesign
- + '/mobile.css" media="only screen and (max-device-width: '
- + maxMobileScreenWidth + 'px)" />');
- $('head').append(
- '<link rel="stylesheet" type="text/css" href="designs/' + thisTemplateEngine.clientDesign
- + '/custom.css" />');
+ $.getCSS( 'designs/designglobals.css' );
+ $.getCSS( 'designs/' + thisTemplateEngine.clientDesign + '/basic.css' );
+ $.getCSS( 'designs/' + thisTemplateEngine.clientDesign + '/mobile.css',
+ {media: 'only screen and (max-device-width: '
+ + maxMobileScreenWidth + 'px)'} );
+ $.getCSS( 'designs/' + thisTemplateEngine.clientDesign + '/custom.css' );
$.getScript( 'designs/' + thisTemplateEngine.clientDesign + '/design_setup.js');
// start with the plugins
Modified: CometVisu/trunk/visu/plugins/colorchooser/structure_plugin.js
===================================================================
--- CometVisu/trunk/visu/plugins/colorchooser/structure_plugin.js 2013-02-02 14:05:53 UTC (rev 1386)
+++ CometVisu/trunk/visu/plugins/colorchooser/structure_plugin.js 2013-02-02 17:00:22 UTC (rev 1387)
@@ -163,5 +163,5 @@
* Include the needed stuff
*/
$.getScript( 'plugins/colorchooser/farbtastic/farbtastic.js' );
-$( 'head' ).append( '<link rel="stylesheet" href="plugins/colorchooser/farbtastic/farbtastic.css" type="text/css" />' );
+$.getCSS( 'plugins/colorchooser/farbtastic/farbtastic.css' );
Modified: CometVisu/trunk/visu/plugins/diagram/structure_plugin.js
===================================================================
--- CometVisu/trunk/visu/plugins/diagram/structure_plugin.js 2013-02-02 14:05:53 UTC (rev 1386)
+++ CometVisu/trunk/visu/plugins/diagram/structure_plugin.js 2013-02-02 17:00:22 UTC (rev 1387)
@@ -52,9 +52,10 @@
*
*/
-
-$("body").append("<script type=\"text/javascript\" src=\"plugins/diagram/flot/jquery.flot.js\"></script>");
-$("body").append("<script type=\"text/javascript\" src=\"plugins/diagram/flot/jquery.flot.axislabels.js\"></script>");
+$.getOrderedScripts([
+ 'plugins/diagram/flot/jquery.flot.js',
+ 'plugins/diagram/flot/jquery.flot.axislabels.js'
+]);
function diagram_get_content( page ) {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|