New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix synchronous loaded scripts #6749

Merged
merged 1 commit into from Nov 7, 2016
Jump to file or symbol
Failed to load files and symbols.
+41 −23
Diff settings

Always

Just for now

BO: Fix synchronous loaded scripts

  • Loading branch information...
Shudrum committed Oct 21, 2016
commit 73fd8dbed9f413a70f7d04fc4badd48f00ca501a
@@ -249,9 +249,6 @@
required: ""
}
},
submitHandler: function(form) {
form.submit();
},
// override jquery validate plugin defaults for bootstrap 3
highlight: function(element) {
$(element).closest('.form-group').addClass('has-error');
@@ -317,4 +314,3 @@
</div>
{/block}
@@ -123,7 +123,12 @@
}
});
{/if}
$(document).ready(function(){
function startTree() {
if (typeof $.fn.tree === 'undefined') {
setTimeout(startTree, 100);
return;
}
$('#{$id|escape:'html':'UTF-8'}').tree('collapseAll');
$('#{$id|escape:'html':'UTF-8'}').find(':input[type=radio]').click(treeClickFunc);
@@ -151,5 +156,6 @@
{else}
$('#collapse-all-{$id|escape:'html':'UTF-8'}').hide();
{/if}
});
}
startTree();
</script>
@@ -35,22 +35,28 @@
{if isset($typeahead_source) && isset($id)}
<script type="text/javascript">
$(document).ready(
function()
{
$(function() {
function startTypeahead() {
if (typeof $.typeahead === 'undefined') {
setTimeout(startTypeahead, 100);
return;
}
$("#{$id|escape:'html':'UTF-8'}").typeahead(
{
name: "{$name|escape:'html':'UTF-8'}",
valueKey: 'name',
local: [{$typeahead_source}]
});
$("#{$id|escape:'html':'UTF-8'}").keypress(function( event ) {
if ( event.which == 13 ) {
$("#{$id|escape:'html':'UTF-8'}").keypress(function (event) {
if (event.which == 13) {
event.stopPropagation();
}
});
}
);
startTypeahead();
});
</script>
{/if}
{/if}
Copy path View file
@@ -390,7 +390,9 @@ public function render($data = null)
$js_path = __PS_BASE_URI__.$admin_webpath.'/themes/'.$bo_theme.'/js/tree.js';
if ($this->getContext()->controller->ajax) {
if (!$this->_no_js) {
$html = '<script type="text/javascript" src="'.$js_path.'"></script>';
$html = '<script type="text/javascript">
$(function(){ $.getScript(\''.$js_path.'\'); });
</script>';
}
} else {
$this->getContext()->controller->addJs($js_path);
@@ -58,7 +58,10 @@ public function render()
}
if ($this->getContext()->controller->ajax) {
$html = '<script type="text/javascript" src="'.__PS_BASE_URI__.$admin_webpath.'/themes/'.$bo_theme.'/js/vendor/typeahead.min.js"></script>';
$path = __PS_BASE_URI__.$admin_webpath.'/themes/'.$bo_theme.'/js/vendor/typeahead.min.js';
$html = '<script type="text/javascript">
$(function(){ $.getScript(\''.$path.'\'); });
</script>';
} else {
$this->getContext()->controller->addJs(__PS_BASE_URI__.$admin_webpath.'/themes/'.$bo_theme.'/js/vendor/typeahead.min.js');
}
@@ -55,7 +55,10 @@ public function render()
}
if ($this->getContext()->controller->ajax) {
$html = '<script type="text/javascript" src="'.__PS_BASE_URI__.$admin_webpath.'/themes/'.$bo_theme.'/js/vendor/typeahead.min.js"></script>';
$path = __PS_BASE_URI__.$admin_webpath.'/themes/'.$bo_theme.'/js/vendor/typeahead.min.js';
$html = '<script type="text/javascript">
$(function(){ $.getScript(\''.$path.'\'); });
</script>';
} else {
$this->getContext()->controller->addJs(__PS_BASE_URI__.$admin_webpath.'/themes/'.$bo_theme.'/js/vendor/typeahead.min.js');
}
Copy path View file
@@ -259,7 +259,6 @@ product_tabs['Combinations'] = new function(){
context: document.body,
dataType: 'json',
context: this,
async: false,
success: function(data) {
// color the selected line
parent.siblings().removeClass('selected-line');
@@ -336,7 +335,6 @@ product_tabs['Combinations'] = new function(){
context: document.body,
dataType: 'json',
context: this,
async: false,
success: function(data) {
if (data.status == 'ok')
{
@@ -368,7 +366,6 @@ product_tabs['Combinations'] = new function(){
context: document.body,
dataType: 'json',
context: this,
async: false,
success: function(data) {
if (data.status == 'ok')
{
@@ -739,7 +736,6 @@ product_tabs['Prices'] = new function(){
},
dataType: 'json',
context: this,
async: false,
success: function(data) {
if (data !== null)
{
@@ -1711,7 +1707,6 @@ function ajaxAction (url, action, success_callback, failure_callback){
},
dataType: 'json',
context: this,
async: false,
success: function(data) {
if (data.status == 'ok')
{
@@ -1911,6 +1906,5 @@ $(document).ready(function() {
$('#product_form').submit(function(e) {
$('#selectedCarriers option').attr('selected', 'selected');
$('#selectAttachment1 option').attr('selected', 'selected');
return true;
});
});
Copy path View file
@@ -1,5 +1,12 @@
function tinySetup(config)
{
if (typeof tinyMCE === 'undefined') {
setTimeout(function() {
tinySetup(config);
}, 100);
return;
}
if(!config)
config = {};
Copy path View file
@@ -9,4 +9,5 @@ var final_path = path_array.join('/');
window.tinyMCEPreInit = {};
window.tinyMCEPreInit.base = final_path+'/js/tiny_mce';
window.tinyMCEPreInit.suffix = '.min';
$('head').append($('<script>').attr('type', 'text/javascript').attr('src', final_path + '/js/tiny_mce/tinymce.min.js'));
$.getScript(final_path+'/js/tiny_mce/tinymce.min.js');
ProTip! Use n and p to navigate between commits in a pull request.