Skip to content

Commit

Permalink
Update MZA_tweak.user.js
Browse files Browse the repository at this point in the history
  • Loading branch information
rasasak authored Aug 12, 2021
1 parent a872976 commit c3f94c2
Showing 1 changed file with 23 additions and 1 deletion.
24 changes: 23 additions & 1 deletion MZA_tweak.user.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// ==UserScript==
// @name MZA tweak
// @version 0.5.5
// @version 0.6.0
// @downloadURL https://github.com/rasasak/MZA_tweak/raw/main/MZA_tweak.user.js
// @updateURL https://github.com/rasasak/MZA_tweak/raw/main/MZA_tweak.user.js
// @description Malá vylepšení pro web MZA...
Expand Down Expand Up @@ -43,6 +43,14 @@ $(document).ready(function() {
$('#seadragon-toolbar .form-group').after(`<a onclick="dezoomify()" id="download" type="button" class="btn btn-light mr-1" title="Stáhnout (Dezoomify)" style="display: inline-block; position: relative;">
<i class="fas fa-cloud-download-alt"></i>
</a>`)
//preserve button
$('#seadragon-toolbar .form-group').after(`<a onclick="preserve()" id="preserve" type="button" class="btn btn-light mr-1" title="Zachovat Zoom" style="display: inline-block; position: relative;"></a>`)

if (g_viewer.preserveViewport == false){
$('#preserve').append(`<i id=preserve_icon class="fas fa-lock-open"></i>`)
}else{
$('#preserve').append(`<i id=preserve_icon class="fas fa-lock"></i>`)
}


// normalize
Expand Down Expand Up @@ -98,3 +106,17 @@ function dezoomify(){
window.open(dezoomify_url, '_blank');
}

if(!unsafeWindow.preserve)
{
unsafeWindow.preserve = preserve;
}

function preserve(){
if (g_viewer.preserveViewport == false){
g_viewer.preserveViewport = true
$('#preserve_icon').attr('class', 'fas fa-lock')
}else{
g_viewer.preserveViewport = false
$('#preserve_icon').attr('class', 'fas fa-lock-open')
}
}

0 comments on commit c3f94c2

Please sign in to comment.