Skip to content
Snippets Groups Projects
Commit 3157b521 authored by Jared Hancock's avatar Jared Hancock
Browse files

Remove unnecessary callback for config

parent 6516b469
Branches
Tags
No related merge requests found
......@@ -13,6 +13,7 @@
vim: expandtab sw=4 ts=4 sts=4:
**********************************************************************/
require_once INCLUDE_DIR . 'class.ajax.php';
if(!defined('INCLUDE_DIR')) die('!');
......@@ -42,7 +43,7 @@ class ConfigAjaxAPI extends AjaxController {
return $this->json_encode($config);
}
function client() {
function client($headers=true) {
global $cfg;
$lang = Internationalization::getCurrentLanguage();
......@@ -62,8 +63,10 @@ class ConfigAjaxAPI extends AjaxController {
);
$config = $this->json_encode($config);
Http::cacheable(md5($config), $cfg->lastModified());
header('Content-Type: application/json; charset=UTF-8');
if ($headers) {
Http::cacheable(md5($config), $cfg->lastModified());
header('Content-Type: application/json; charset=UTF-8');
}
return $config;
}
......
......@@ -14,5 +14,12 @@ if (($lang = Internationalization::getCurrentLanguage()) && $lang != 'en_US') {
<script type="text/javascript" src="ajax.php/i18n/<?php
echo $lang; ?>/js"></script>
<?php } ?>
<script type="text/javascript">
getConfig().resolve(<?php
include INCLUDE_DIR . 'ajax.config.php';
$api = new ConfigAjaxAPI();
print $api->client(false);
?>);
</script>
</body>
</html>
......@@ -78,39 +78,6 @@ $(document).ready(function(){
});
getConfig = (function() {
var dfd = $.Deferred(),
requested = false;
return function() {
if (dfd.state() != 'resolved' && !requested)
requested = $.ajax({
url: "ajax.php/config/client",
dataType: 'json',
success: function (json_config) {
dfd.resolve(json_config);
}
});
return dfd;
}
})();
$.translate_format = function(str) {
var translation = {
'd':'dd',
'j':'d',
'z':'o',
'm':'mm',
'F':'MM',
'n':'m',
'Y':'yy'
};
// Change PHP formats to datepicker ones
$.each(translation, function(php, jqdp) {
str = str.replace(php, jqdp);
});
return str;
};
var showNonLocalImage = function(div) {
var $div = $(div),
$img = $div.append($('<img>')
......@@ -199,7 +166,32 @@ showImagesInline = function(urls, thread_id) {
e.data('wrapped', true);
}
});
}
};
getConfig = (function() {
var dfd = $.Deferred(),
requested = false;
return function() {
return dfd;
};
})();
$.translate_format = function(str) {
var translation = {
'd':'dd',
'j':'d',
'z':'o',
'm':'mm',
'F':'MM',
'n':'m',
'Y':'yy'
};
// Change PHP formats to datepicker ones
$.each(translation, function(php, jqdp) {
str = str.replace(php, jqdp);
});
return str;
};
$.sysAlert = function (title, msg, cb) {
var $dialog = $('.dialog#alert');
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment