ajaxify image rotate

Solving the caching issue
This commit is contained in:
onli 2014-01-19 17:59:28 +01:00
parent 82a0d1f4bb
commit 75a95382a4

View File

@ -618,6 +618,10 @@ window.log = function f(){ log.history = log.history || []; log.history.push(arg
};
serendipity.reloadImage = function(img) {
$(img).attr('src', $(img).attr('src')+'?'+Math.random());
}
}( window.serendipity = window.serendipity || {}, jQuery ));
// Source: https://github.com/yatil/accessifyhtml5.js
@ -1117,6 +1121,15 @@ var AccessifyHTML5 = function (defaults, more_fixes) {
$('#' + window.location.hash.replace('#', '')).find(".toggle_info").click();
}
// ajaxify image rotate, solving cache issue
$('.media_rotate_right,.media_rotate_left').click(function(e) {
e.preventDefault();
var $rotateButton = $(this)
$.get($rotateButton.attr('href'), function() {
serendipity.reloadImage($rotateButton.closest('.media_file').find('img'));
});
})
// Tabs
if($('body').has('.tabs').size() > 0) {
$('.tabs').accessibleTabs({