mirror of
https://github.com/FrankerFaceZ/FrankerFaceZ.git
synced 2025-06-28 15:27:43 +00:00
3.5.266. Yeah. This is me remembering to commit again, but only because I told someone to make a pull request.
This commit is contained in:
parent
86546ba7d8
commit
8310f89aa0
25 changed files with 717 additions and 592 deletions
17
src/utils.js
17
src/utils.js
|
@ -466,8 +466,19 @@ module.exports = FFZ.utils = {
|
|||
if ( typeof pref === "function" )
|
||||
pref = pref.call(this);
|
||||
|
||||
var dir = {ns: pref[0], ew: (pref.length > 1 ? pref[1] : false)},
|
||||
$this = $(this),
|
||||
var dir = {};
|
||||
|
||||
if ( pref.indexOf('n') !== -1 )
|
||||
dir.ns = 'n';
|
||||
else if ( pref.indexOf('s') !== -1 )
|
||||
dir.ns = 's';
|
||||
|
||||
if ( pref.indexOf('e') !== -1 )
|
||||
dir.ew = 'e';
|
||||
else if ( pref.indexOf('w') !== -1 )
|
||||
dir.ew = 'w';
|
||||
|
||||
var $this = $(this),
|
||||
half_width = $this.width() / 2,
|
||||
half_height = $this.height() / 2,
|
||||
boundTop = $(document).scrollTop() + half_height + (margin*2),
|
||||
|
@ -478,7 +489,7 @@ module.exports = FFZ.utils = {
|
|||
if ($(window).width() + $(document).scrollLeft() - ($this.offset().left + half_width) < margin) dir.ew = 'e';
|
||||
if ($(window).height() + $(document).scrollTop() - ($this.offset().top + half_height) < (2*margin)) dir.ns = 's';
|
||||
|
||||
return dir.ns + (dir.ew ? dir.ew : '');
|
||||
return (dir.ns ? dir.ns : '') + (dir.ew ? dir.ew : '');
|
||||
}
|
||||
},
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue