MediaWiki:Common.js: Difference between revisions
No edit summary Tags: Reverted Mobile edit Mobile web edit |
No edit summary Tags: Reverted Mobile edit Mobile web edit |
||
| Line 89: | Line 89: | ||
if ($('#mippedia-data-btn').length) return; | if ($('#mippedia-data-btn').length) return; | ||
// Otak Cerdas | // Otak Cerdas: Ambil link render resolusi tinggi (64px) dari server agar tidak buram | ||
var api = new mw.Api(); | var api = new mw.Api(); | ||
api.get({ | api.get({ | ||
| Line 96: | Line 96: | ||
prop: 'imageinfo', | prop: 'imageinfo', | ||
iiprop: 'url', | iiprop: 'url', | ||
iiurlwidth: | iiurlwidth: 64, | ||
format: 'json' | format: 'json' | ||
}).done(function(data) { | }).done(function(data) { | ||
| Line 104: | Line 104: | ||
for (var id in pages) { | for (var id in pages) { | ||
if (pages[id].imageinfo && pages[id].imageinfo[0]) { | if (pages[id].imageinfo && pages[id].imageinfo[0]) { | ||
imageUrl = pages[id].imageinfo[0].thumburl || pages[id].imageinfo[0].url; | imageUrl = pages[id].imageinfo[0].thumburl || pages[id].imageinfo[0].url; | ||
} | } | ||
| Line 112: | Line 111: | ||
} | } | ||
if (!imageUrl) return; | if (!imageUrl) return; | ||
| Line 119: | Line 117: | ||
href: domain + '/wiki/' + encodeURIComponent(name), | href: domain + '/wiki/' + encodeURIComponent(name), | ||
target: '_blank', | target: '_blank', | ||
style: 'position: absolute; right: | // top: 2px dan right: 12px disesuaikan agar pas di barisan menu mobile minerva | ||
style: 'position: absolute; right: 12px; top: 2px; z-index: 1000; text-decoration: none; display: inline-block; transition: transform 0.2s;', | |||
html: $('<img>', { | html: $('<img>', { | ||
src: imageUrl, | src: imageUrl, | ||
alt: 'Data Icon', | alt: 'Data Icon', | ||
style: 'height: | // Memaksa dimensi tampilan ke 20px agar seukuran dengan tombol bintang/edit bawaan | ||
style: 'height: 20px; width: 20px; display: block; opacity: 0.85; vertical-align: middle;' | |||
}) | }) | ||
}); | }); | ||
// Efek hover | // Efek interaksi hover/touch tipis | ||
$btn.hover( | $btn.hover( | ||
function() { $(this).css('transform' | function() { $(this).css({ 'transform': 'scale(1.1)', 'opacity': '1' }); }, | ||
function() { $(this).css('transform' | function() { $(this).css({ 'transform': 'scale(1.0)', 'opacity': '0.85' }); } | ||
); | ); | ||
var $target = $('.page-actions-menu, .mw-editsection-visualeditor, #ca-edit, .minerva__tab-container').first(); | var $target = $('.page-actions-menu, .mw-editsection-visualeditor, #ca-edit, .minerva__tab-container').first(); | ||
| Line 139: | Line 138: | ||
$target.css('position', 'relative').append($btn); | $target.css('position', 'relative').append($btn); | ||
} else { | } else { | ||
$('#firstHeading').css('position', 'relative').append($btn); | $('#firstHeading').css('position', 'relative').append($btn); | ||
$btn.css('top', ' | $btn.css('top', '8px'); | ||
} | } | ||
}); | }); | ||
} | } | ||
}); | }); | ||