docbrown/app/assets/javascripts/initializePage.js.erb
Nick Taylor 18980034d3 Nick/feature/search to preact (#532)
* Works, but lots of cleanup/questions.

* Fixed comment.

* Only want the search script to load once with InstantClick active.

* Removed unnecessary DOMContentLoaded from copy paste.

* 🔧 Enabled (P)React Devtools.

* Updated comment about reactToEvent.

* Removed unnecessary server-side generated JS for search.

* <Search /> component now has component state.

* Search functions are in there own module now.

* 👷Refactor

* Render propped it up.

* Fixed issue with encoding of search term.

* Removed data-no-instant attr from script.

* 👷Refactor

* Now flash of search loading is avoided..

* Moved search under components folder.

* Tests

* fixedEncodeURIComponent does not need to be exported.

* Tests

* Folders to ignore from the VS Code Local History extension.

* Tests

* Snapshot test for <Search /> component.

* Tests

* Now the <SearchContainer /> handles the '/' key shortcut.

* Made the search box ID a prop defaulting to 'nav-search'

* Excluded barrel files from code coverage.

* Componentized search CSS.

* Storybook stories for <Search /> component.

* Removed extension folders to ignore.

* Fixed logic for "/" key triggering search.

* updated jest snapshot for <Search /> component.

* updated package.json lock file.

* Disabled the import/prefer-default-export rule.

* Now search term clears if not on a non-search results page.

* removed comment that is no longer valid.

* No longer using render prop for Search. Doesn't make sense as it's not stuff that is reused.

* Added preact-render-spy do dev deps.
2018-07-19 17:02:48 -04:00

61 lines
No EOL
1.6 KiB
Text

function initializePage(){
initializeLocalStorageRender();
initializeStylesheetAppend();
initializeFetchFollowedArticles();
callInitalizers();
}
function callInitalizers(){
initializeLocalStorageRender();
initializeBodyData();
var waitingForDataLoad = setInterval(function(){
if (document.getElementsByTagName('body')[0].getAttribute('data-loaded') == "true") {
clearInterval(waitingForDataLoad);
if (document.getElementsByTagName('body')[0].getAttribute('data-user-status') == "logged-in") {
initializeBaseUserData();
}
initializeReadingListPage();
initializeAllFollowButts();
initializeReadingListIcons();
initializeSponsorshipVisibility();
if ( document.getElementById("sidebar-additional") ) {
document.getElementById("sidebar-additional").classList.add("showing");
}
}
},1)
initializeBaseTracking();
initializeTouchDevice();
initializeCommentsPage();
initEditorResize();
initLeaveEditorWarning();
initializeArticleReactions();
initNotifications();
initializeSplitTestTracking();
initializeStylesheetAppend();
initializeAnalytics();
initializeCommentDropdown();
initializeSettings();
initializeFooterMod();
initializeCommentPreview();
initializeAdditionalContentBoxes();
initializeTimeFixer();
if (!initializeLiveArticle.called){
initializeLiveArticle();
}
initializeDrawerSliders();
function freezeScrolling(event){
event.preventDefault();
}
nextPage = 0;
fetching = false;
done = false;
setTimeout(function(){
done = false;
},300);
if(!initScrolling.called) {
initScrolling();
}
}