Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(gemini): Correct anchors in articles
- Loading branch information
Kristinita
authored and
Kristinita
committed
Mar 26, 2018
1 parent
d33776a
commit 192c040
Showing
14 changed files
with
308 additions
and
242 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 |
---|---|---|
@@ -1,27 +1,32 @@ | ||
######################## | ||
## grunt-browser-sync ## | ||
######################## | ||
# Live Reloading: | ||
# https://www.npmjs.com/package/grunt-browser-sync | ||
module.exports = | ||
bsFiles: | ||
src : ['output/theme/css/**/*.css', 'output/theme/css/**/**/*.css', 'output/theme/js/**/*.js'] | ||
options: | ||
port: 3000 | ||
server: | ||
baseDir: "../" | ||
# localtunnel doesn't work, see: | ||
# https://github.com/BrowserSync/browser-sync/issues/1513 | ||
tunnel: false | ||
plugins: [ | ||
################### | ||
## html-injector ## | ||
################### | ||
# That HTML don't refresh, if I change HTML file: | ||
# https://github.com/shakyshane/html-injector | ||
# JavaScript needs refresh, see | ||
# https://stackoverflow.com/q/30762114/5951529 | ||
module: "bs-html-injector" | ||
options: | ||
files: "<%= templates.paths.html %>" | ||
] | ||
######################## | ||
## grunt-browser-sync ## | ||
######################## | ||
# Live Reloading: | ||
# https://www.npmjs.com/package/grunt-browser-sync | ||
module.exports = | ||
bsFiles: | ||
src : ['output/theme/css/**/*.css', 'output/theme/css/**/**/*.css', 'output/theme/js/**/*.js'] | ||
options: | ||
# Doesn't open “http://localhost:3001/” tab, when BrowserSync start: | ||
# https://browsersync.io/docs/options#option-open | ||
open: false | ||
port: 3000 | ||
server: | ||
baseDir: "../" | ||
# localtunnel doesn't work, see: | ||
# https://github.com/BrowserSync/browser-sync/issues/1513 | ||
tunnel: false | ||
plugins: [ | ||
################### | ||
## html-injector ## | ||
################### | ||
# That HTML don't refresh, if I change HTML file: | ||
# https://github.com/shakyshane/html-injector | ||
# JavaScript needs refresh: | ||
# https://stackoverflow.com/q/30762114/5951529 | ||
# If I change HTML or CSS in HTML file, I need save file, that to see changes in browser. | ||
# Else I change JavaScript in HTML file, I need save file 2 times, that HTML page reload in browser and I can to see changes in browser. | ||
module: "bs-html-injector" | ||
options: | ||
files: "<%= templates.paths.html %>" | ||
] |
177 changes: 117 additions & 60 deletions
177
themes/sashapelican/static/js/Gemini/GeminiAndJQueryLazy.js
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 |
---|---|---|
@@ -1,60 +1,117 @@ | ||
// @Author: Kristinita | ||
// @Date: 2017-05-02 11:44:00 | ||
// @Last Modified time: 2018-03-02 12:45:05 | ||
//////////// | ||
// Gemini // | ||
//////////// | ||
// Example — https://github.com/noeldelgado/gemini-scrollbar/blob/master/examples/01-body.html | ||
window.onload = function() { | ||
if (window.matchMedia("(orientation: landscape)").matches) { | ||
// For landscape orientation | ||
var landscapescrollbar = new GeminiScrollbar({ | ||
// querySelector method — https://www.w3schools.com/jsref/met_document_queryselector.asp | ||
element: document.querySelector("main"), | ||
autoshow: true, | ||
// Force Gemini for correct scrollbar displaying in mobile devices | ||
// https://github.com/noeldelgado/gemini-scrollbar#options | ||
forceGemini: true, | ||
}).create(); | ||
|
||
window.myscroolbar = landscapescrollbar; | ||
|
||
// JQuery Lazy support — | ||
// https://github.com/eisbehr-/jquery.lazy/issues/88#issuecomment-299138103 | ||
$(".SashaLazy").Lazy({ | ||
appendScroll: $(landscapescrollbar.getViewElement()), | ||
// Run method “update” of Gemini: | ||
// https://github.com/eisbehr-/jquery.lazy/issues/88#issuecomment-299196388 | ||
// http://jquery.eisbehr.de/lazy/example_callback-functions | ||
// https://github.com/noeldelgado/gemini-scrollbar#basic-methods | ||
afterLoad: function() { | ||
landscapescrollbar.update(); | ||
} | ||
}); | ||
} else { | ||
// For portrait orientation | ||
var portraitscrollbar = new GeminiScrollbar({ | ||
element: document.querySelector("body"), | ||
autoshow: true, | ||
forceGemini: true, | ||
}).create(); | ||
|
||
window.myscroolbar = portraitscrollbar; | ||
|
||
$(".SashaLazy").Lazy({ | ||
appendScroll: $(portraitscrollbar.getViewElement()), | ||
afterLoad: function() { | ||
portraitscrollbar.update(); | ||
} | ||
}); | ||
} | ||
|
||
}; | ||
|
||
// Scrollbar works on resize | ||
// Thanks to Alfy — https://vk.com/dark_alf | ||
window.onresize = function() { | ||
if(window.myscroolbar) | ||
window.myscroolbar.destroy(); | ||
window.onload(); | ||
}; | ||
// @Author: Kristinita | ||
// @Date: 2017-05-02 11:44:00 | ||
// @Last Modified time: 2018-03-24 08:49:55 | ||
////////////////////// | ||
// gemini-scrollbar // | ||
////////////////////// | ||
// Custom scrollbar instead of native body scrollbar: | ||
// https://github.com/noeldelgado/gemini-scrollbar/issues/46#issuecomment-374928170 | ||
var internals; | ||
|
||
internals = {}; | ||
|
||
internals.initialize = function() { | ||
internals.scrollbar = new GeminiScrollbar({ | ||
// querySelector method — https://www.w3schools.com/jsref/met_document_queryselector.asp | ||
element: document.querySelector("body"), | ||
autoshow: true, | ||
// Force Gemini for correct scrollbar displaying in mobile devices | ||
// https://github.com/noeldelgado/gemini-scrollbar#options | ||
forceGemini: true | ||
}).create(); | ||
internals.scrollingElement = internals.scrollbar.getViewElement(); | ||
internals.scrollToHash(); | ||
|
||
// JQuery Lazy support — | ||
// https://github.com/eisbehr-/jquery.lazy/issues/88#issuecomment-299138103 | ||
$(".SashaLazy").Lazy({ | ||
appendScroll: $(internals.scrollbar.getViewElement()), | ||
// Run method “update” of Gemini: | ||
// https://github.com/eisbehr-/jquery.lazy/issues/88#issuecomment-299196388 | ||
// http://jquery.eisbehr.de/lazy/example_callback-functions | ||
// https://github.com/noeldelgado/gemini-scrollbar#basic-methods | ||
afterLoad: function() { | ||
internals.scrollbar.update(); | ||
} | ||
}); | ||
}; | ||
|
||
internals.handleOrientationChange = function() { | ||
internals.scrollbar.update(); | ||
internals.scrollToHash(); | ||
}; | ||
|
||
internals.scrollToHash = function() { | ||
var element, hash; | ||
hash = location.hash; | ||
if (hash) { | ||
element = document.getElementById(hash.replace("#", "")); | ||
if (element) { | ||
internals.scrollingElement.scrollTo(0, element.offsetTop); | ||
} | ||
} | ||
}; | ||
|
||
/* Listeners */ | ||
|
||
window.onload = internals.initialize; | ||
|
||
window.onorientationchange = internals.handleOrientationChange; | ||
|
||
|
||
////////////////// | ||
// [DEPRECATED] // | ||
////////////////// | ||
// window.onload = function() { | ||
// if (window.matchMedia("(orientation: landscape)").matches) { | ||
// // For landscape orientation | ||
// var landscapescrollbar = new GeminiScrollbar({ | ||
// // querySelector method — https://www.w3schools.com/jsref/met_document_queryselector.asp | ||
// element: document.querySelector("main"), | ||
// autoshow: true, | ||
// // Force Gemini for correct scrollbar displaying in mobile devices | ||
// // https://github.com/noeldelgado/gemini-scrollbar#options | ||
// forceGemini: true, | ||
// }).create(); | ||
|
||
// window.myscroolbar = landscapescrollbar; | ||
|
||
// // JQuery Lazy support — | ||
// // https://github.com/eisbehr-/jquery.lazy/issues/88#issuecomment-299138103 | ||
// $(".SashaLazy").Lazy({ | ||
// appendScroll: $(landscapescrollbar.getViewElement()), | ||
// // Run method “update” of Gemini: | ||
// // https://github.com/eisbehr-/jquery.lazy/issues/88#issuecomment-299196388 | ||
// // http://jquery.eisbehr.de/lazy/example_callback-functions | ||
// // https://github.com/noeldelgado/gemini-scrollbar#basic-methods | ||
// afterLoad: function() { | ||
// landscapescrollbar.update(); | ||
// } | ||
// }); | ||
// } else { | ||
// // For portrait orientation | ||
// var portraitscrollbar = new GeminiScrollbar({ | ||
// element: document.querySelector("body"), | ||
// autoshow: true, | ||
// forceGemini: true, | ||
// }).create(); | ||
|
||
// window.myscroolbar = portraitscrollbar; | ||
|
||
// $(".SashaLazy").Lazy({ | ||
// appendScroll: $(portraitscrollbar.getViewElement()), | ||
// afterLoad: function() { | ||
// portraitscrollbar.update(); | ||
// } | ||
// }); | ||
// } | ||
|
||
// }; | ||
|
||
// // Scrollbar works on resize | ||
// // Thanks to Alfy — https://vk.com/dark_alf | ||
// window.onresize = function() { | ||
// if(window.myscroolbar) | ||
// window.myscroolbar.destroy(); | ||
// window.onload(); | ||
// }; |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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
Oops, something went wrong.