forked from extesy/hoverzoom
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
New plug-in for: eksisozluk.com (extesy#986)
- Loading branch information
1 parent
9036ad7
commit b857c4c
Showing
2 changed files
with
35 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
var hoverZoomPlugins = hoverZoomPlugins || []; | ||
hoverZoomPlugins.push( { | ||
name: 'eksisozluk', | ||
version: '1.0', | ||
prepareImgLinks: function(callback) { | ||
var res = []; | ||
|
||
// page hosting link to img: https://eksisozluk.com/entry/140581590 | ||
// link to img: https://soz.lk/i/3jadcz74 | ||
// fullsize img: https://cdn.eksisozluk.com/2022/7/28/3/3jadcz74.jpg | ||
$('a[href*="/soz.lk/"]:not(.hoverZoomMouseover)').addClass('hoverZoomMouseover').one('mouseover', function() { | ||
|
||
var link = undefined; | ||
var href = undefined; | ||
|
||
href = this.href; | ||
link = $(this); | ||
|
||
// clean previous result | ||
link.data().hoverZoomSrc = []; | ||
hoverZoom.prepareFromDocument($(this), this.href, function(doc) { | ||
|
||
let img = doc.querySelector('img'); | ||
if (img) return img.src; | ||
|
||
}, false); // get source sync | ||
}); | ||
|
||
callback($(res), this.name); | ||
} | ||
}); |