mirror of
https://github.com/readthedocs/sphinx_rtd_theme.git
synced 2025-02-25 18:55:21 -06:00
Fix theme logic and rebuild prod assets
This commit is contained in:
parent
3c1a1bbc84
commit
a0b2ccc3f7
@ -159,7 +159,7 @@
|
|||||||
|
|
||||||
{# PAGE CONTENT #}
|
{# PAGE CONTENT #}
|
||||||
<div class="wy-nav-content">
|
<div class="wy-nav-content">
|
||||||
{% if (theme_style_external_links == 'True') %}
|
{% if theme_style_external_links %}
|
||||||
<div class="rst-content style-external-links">
|
<div class="rst-content style-external-links">
|
||||||
{% else %}
|
{% else %}
|
||||||
<div class="rst-content">
|
<div class="rst-content">
|
||||||
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -30,16 +30,21 @@ function ThemeNav () {
|
|||||||
// Set scroll monitor
|
// Set scroll monitor
|
||||||
self.win.on('scroll', function () {
|
self.win.on('scroll', function () {
|
||||||
if (!self.linkScroll) {
|
if (!self.linkScroll) {
|
||||||
self.winScroll = true;
|
if (!self.winScroll) {
|
||||||
|
self.winScroll = true;
|
||||||
|
requestAnimationFrame(function() { self.onScroll(); });
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
setInterval(function () { if (self.winScroll) self.onScroll(); }, 25);
|
|
||||||
|
|
||||||
// Set resize monitor
|
// Set resize monitor
|
||||||
self.win.on('resize', function () {
|
self.win.on('resize', function () {
|
||||||
self.winResize = true;
|
if (!self.winResize) {
|
||||||
|
self.winResize = true;
|
||||||
|
requestAnimationFrame(function() { self.onResize(); });
|
||||||
|
}
|
||||||
});
|
});
|
||||||
setInterval(function () { if (self.winResize) self.onResize(); }, 25);
|
|
||||||
self.onResize();
|
self.onResize();
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
@ -168,4 +173,34 @@ if (typeof(window) != 'undefined') {
|
|||||||
window.SphinxRtdTheme = { StickyNav: module.exports.ThemeNav };
|
window.SphinxRtdTheme = { StickyNav: module.exports.ThemeNav };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// requestAnimationFrame polyfill by Erik Möller. fixes from Paul Irish and Tino Zijdel
|
||||||
|
// https://gist.github.com/paulirish/1579671
|
||||||
|
// MIT license
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
var lastTime = 0;
|
||||||
|
var vendors = ['ms', 'moz', 'webkit', 'o'];
|
||||||
|
for(var x = 0; x < vendors.length && !window.requestAnimationFrame; ++x) {
|
||||||
|
window.requestAnimationFrame = window[vendors[x]+'RequestAnimationFrame'];
|
||||||
|
window.cancelAnimationFrame = window[vendors[x]+'CancelAnimationFrame']
|
||||||
|
|| window[vendors[x]+'CancelRequestAnimationFrame'];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!window.requestAnimationFrame)
|
||||||
|
window.requestAnimationFrame = function(callback, element) {
|
||||||
|
var currTime = new Date().getTime();
|
||||||
|
var timeToCall = Math.max(0, 16 - (currTime - lastTime));
|
||||||
|
var id = window.setTimeout(function() { callback(currTime + timeToCall); },
|
||||||
|
timeToCall);
|
||||||
|
lastTime = currTime + timeToCall;
|
||||||
|
return id;
|
||||||
|
};
|
||||||
|
|
||||||
|
if (!window.cancelAnimationFrame)
|
||||||
|
window.cancelAnimationFrame = function(id) {
|
||||||
|
clearTimeout(id);
|
||||||
|
};
|
||||||
|
}());
|
||||||
|
|
||||||
},{"jquery":"jquery"}]},{},["sphinx-rtd-theme"]);
|
},{"jquery":"jquery"}]},{},["sphinx-rtd-theme"]);
|
||||||
|
Loading…
Reference in New Issue
Block a user