Skip to content

Commit

Permalink
Theme Bootstrap: Fixed a ReferenceError of jQuery (rathena#181)
Browse files Browse the repository at this point in the history
* Fixed a ReferenceError of jQuery which got accessed before the jQuery
itself got imported.

* Fixed ReferenceError $.
Restructured the footer.php and moved the script which references to
jQuery after the initial jQuery import.
  • Loading branch information
kraaijmakers authored and Akkarinage committed Jun 11, 2018
1 parent 247735f commit cb92485
Showing 1 changed file with 45 additions and 43 deletions.
88 changes: 45 additions & 43 deletions themes/bootstrap/footer.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,50 @@
<script src="<?php echo $this->themePath('js/ie9.js') ?>" type="text/javascript"></script>
<script type="text/javascript" src="<?php echo $this->themePath('js/flux.unitpngfix.js') ?>"></script>
<![endif]-->

<script type="text/javascript">
function updatePreferredServer(sel){
var preferred = sel.options[sel.selectedIndex].value;
document.preferred_server_form.preferred_server.value = preferred;
document.preferred_server_form.submit();
}

function updatePreferredTheme(sel){
var preferred = sel.options[sel.selectedIndex].value;
document.preferred_theme_form.preferred_theme.value = preferred;
document.preferred_theme_form.submit();
}

// Preload spinner image.
var spinner = new Image();
spinner.src = '<?php echo $this->themePath('img/spinner.gif') ?>';

function refreshSecurityCode(imgSelector){
$(imgSelector).attr('src', spinner.src);

// Load image, spinner will be active until loading is complete.
var clean = <?php echo Flux::config('UseCleanUrls') ? 'true' : 'false' ?>;
var image = new Image();
image.src = "<?php echo $this->url('captcha') ?>"+(clean ? '?nocache=' : '&nocache=')+Math.random();

$(imgSelector).attr('src', image.src);
}
function toggleSearchForm()
{
//$('.search-form').toggle();
$('.search-form').slideToggle('fast');
}
</script>

<?php if (Flux::config('EnableReCaptcha') && Flux::config('ReCaptchaTheme')): ?>
<script type="text/javascript">
var RecaptchaOptions = {
theme : '<?php echo Flux::config('ReCaptchaTheme') ?>'
};
</script>
<?php endif ?>

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
var inputs = 'input[type=text],input[type=password],input[type=file]';
Expand Down Expand Up @@ -87,51 +131,9 @@ function reload(){
window.location.href = '<?php echo $this->url ?>';
}
</script>

<script type="text/javascript">
function updatePreferredServer(sel){
var preferred = sel.options[sel.selectedIndex].value;
document.preferred_server_form.preferred_server.value = preferred;
document.preferred_server_form.submit();
}

function updatePreferredTheme(sel){
var preferred = sel.options[sel.selectedIndex].value;
document.preferred_theme_form.preferred_theme.value = preferred;
document.preferred_theme_form.submit();
}

// Preload spinner image.
var spinner = new Image();
spinner.src = '<?php echo $this->themePath('img/spinner.gif') ?>';

function refreshSecurityCode(imgSelector){
$(imgSelector).attr('src', spinner.src);

// Load image, spinner will be active until loading is complete.
var clean = <?php echo Flux::config('UseCleanUrls') ? 'true' : 'false' ?>;
var image = new Image();
image.src = "<?php echo $this->url('captcha') ?>"+(clean ? '?nocache=' : '&nocache=')+Math.random();

$(imgSelector).attr('src', image.src);
}
function toggleSearchForm()
{
//$('.search-form').toggle();
$('.search-form').slideToggle('fast');
}
</script>

<?php if (Flux::config('EnableReCaptcha') && Flux::config('ReCaptchaTheme')): ?>
<script type="text/javascript">
var RecaptchaOptions = {
theme : '<?php echo Flux::config('ReCaptchaTheme') ?>'
};
</script>
<?php endif ?>
<script type="text/javascript" src="<?php echo $this->themePath('js/flux.datefields.js') ?>"></script>
<script type="text/javascript" src="<?php echo $this->themePath('js/flux.unitip.js') ?>"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
</body>
</html>

0 comments on commit cb92485

Please sign in to comment.