Skip to content
Browse files

Moved the scheduler script into an external file

  • Loading branch information...
1 parent 7b304b8 commit 8b0e987a7f2b14ea45f7df581c614da153a137da @leofeyer leofeyer committed Feb 14, 2012
View
6 .gitignore
@@ -13,15 +13,13 @@ nbproject/
# Contao
.htaccess
*.xml
+cron.txt
assets/css/*
assets/images/*
assets/js/*
share/*
-system/cache
-system/cron/cron.txt
-system/html
+system/cache/*
system/logs/*
-system/scripts
system/tmp/*
system/config/dcaconfig.php
system/config/initconfig.php
View
2 assets/contao/debug.css
@@ -1,2 +1,2 @@
-/* Contao Open Source CMS :: Copyright (C) 2005-2012 Leo Feyer :: LGPL license */
+/* Contao Open Source CMS, (C) 2005-2012 Leo Feyer, LGPL license */
#debug *{color:#444;line-height:1}#debug p{margin:0;padding:12px 10px;border-top:1px solid #666;border-bottom:1px solid #bbb;position:fixed;bottom:260px;background:#ddd;background-image:-moz-linear-gradient(top,#eee,#ddd);background-image:-webkit-gradient(linear,left top,left bottom,color-stop(0,#eee),color-stop(1,#ddd));background-image:-o-linear-gradient(top,#eee,#ddd);background-image:-ms-linear-gradient(top,#eee,#ddd);background-image:linear-gradient(top,#eee,#ddd)}#debug p span{padding:1px 20px;font-size:11px;font-family:Verdana,sans-serif}#debug .info{background:url("../../system/themes/default/images/show.gif") left 0 no-repeat}#debug .time{background:url("../../system/themes/default/images/news.gif") left 0 no-repeat}#debug .memory{background:url("../../system/themes/default/images/modules.gif") left 0 no-repeat}#debug .db{background:url("../../system/themes/default/images/db.gif") left 0 no-repeat}#debug div{height:260px;position:fixed;bottom:0;overflow:auto;background:#fff}#debug pre{padding:10px}#debug pre,#debug pre *{font-family:"Andale Mono",monospace}#debug.closed p{bottom:-1px}#debug.closed div{height:0}#debug #tog{position:absolute;top:2px;height:28px;right:28px;background:url("../../system/themes/default/images/expand.gif") right 5px no-repeat;cursor:pointer}#debug.closed #tog{background-image:url("../../system/themes/default/images/collapse.gif")}
View
2 assets/contao/framework.css
@@ -1,2 +1,2 @@
-/* Contao Open Source CMS :: Copyright (C) 2005-2012 Leo Feyer :: LGPL license */
+/* Contao Open Source CMS, (C) 2005-2012 Leo Feyer, LGPL license */
body{margin:0;padding:0;font-size:100.01%;text-align:left;position:relative}select,input,textarea{font-size:99%}form{margin:0;padding:0}img{border:0}#left{float:left}#right{float:right}#main{width:auto;position:relative}.inside{position:relative;text-align:left}.block{overflow:hidden}.clear,#clear{height:0.1px;font-size:0.1px;line-height:0.1px;clear:both}.invisible{width:0;height:0;left:-1000px;top:-1000px;position:absolute;overflow:hidden;display:inline}.custom{display:block;text-align:left}.custom:after{content:".";display:block;height:0;clear:both;visibility:hidden}*+html #main{position:static}header,footer,nav,section,aside,article,figure,figcaption{display:block}
View
2 assets/contao/scheduler.js
@@ -0,0 +1,2 @@
+/* Contao Open Source CMS, (C) 2005-2012 Leo Feyer, LGPL license */
+setTimeout(function(){window.jQuery?jQuery.ajax("system/cron/cron.txt",{complete:function(a){var b=a.responseText||0;parseInt(b)<Math.round(+(new Date)/1e3)-300&&jQuery.ajax("system/cron/cron.php")}}):window.MooTools&&(new Request({url:"system/cron/cron.txt",onComplete:function(a){a||(a=0),parseInt(a)<Math.round(+(new Date)/1e3)-300&&(new Request({url:"system/cron/cron.php"})).get()}})).get()},5e3);
View
25 system/modules/frontend/templates/fe_page.html5
@@ -67,30 +67,7 @@
<?php echo $this->mootools; ?>
<?php if (!$this->disableCron): ?>
-<script>
-setTimeout(function() {
- if (window.jQuery) {
- jQuery.ajax('system/cron/cron.txt', {
- complete: function(xhr) {
- var txt = xhr.responseText || 0;
- if (parseInt(txt) < (Math.round(+new Date()/1000) - 300)) {
- jQuery.ajax('system/cron/cron.php');
- }
- }
- });
- } else if (window.MooTools) {
- new Request({
- url:'system/cron/cron.txt',
- onComplete: function(txt) {
- if (!txt) txt = 0;
- if (parseInt(txt) < (Math.round(+new Date()/1000) - 300)) {
- new Request({url:'system/cron/cron.php'}).get();
- }
- }
- }).get();
- }
-}, 5000);
-</script>
+<script src="assets/contao/scheduler.js"></script>
<?php endif; ?>
</body>
View
27 system/modules/frontend/templates/fe_page.xhtml
@@ -68,32 +68,7 @@
<?php echo $this->mootools; ?>
<?php if (!$this->disableCron): ?>
-<script type="text/javascript">
-/* <![CDATA[ */
-setTimeout(function() {
- if (window.jQuery) {
- jQuery.ajax('system/cron/cron.txt', {
- complete: function(xhr) {
- var txt = xhr.responseText || 0;
- if (parseInt(txt) < (Math.round(+new Date()/1000) - 300)) {
- jQuery.ajax('system/cron/cron.php');
- }
- }
- });
- } else if (window.MooTools) {
- new Request({
- url:'system/cron/cron.txt',
- onComplete: function(txt) {
- if (!txt) txt = 0;
- if (parseInt(txt) < (Math.round(+new Date()/1000) - 300)) {
- new Request({url:'system/cron/cron.php'}).get();
- }
- }
- }).get();
- }
-}, 5000);
-/* ]]> */
-</script>
+<script type="text/javascript" src="assets/contao/scheduler.js"></script>
<?php endif; ?>
</body>
View
2,530 templates/music_academy.sql
1,265 additions, 1,265 deletions not shown because the diff is too large. Please use a local Git client to view these changes.

5 comments on commit 8b0e987

@Toflar
Contao member
Toflar commented on 8b0e987 Feb 15, 2012

Can't we add this to the combiner? This one forces an additional request. Just thinking aloud. Tell me if there's any reason for not adding it to the combiner :)

@leofeyer
Contao member

Scripts in the head block the download of resources, so in my opinion it makes more sense to load everything we can at the end of the page and keep the combined file as small as possible.

@Toflar
Contao member
Toflar commented on 8b0e987 Feb 16, 2012

Hmm. But we could load the combined file at the end of the page (which would be good practice anyway). Additional requests will never be as fast as one bigger combined file.

@leofeyer
Contao member

I know, but currently not possible for reasons of backwards compatibility.

@Toflar
Contao member
Toflar commented on 8b0e987 Feb 17, 2012

Alright :)

Please sign in to comment.
Something went wrong with that request. Please try again.