docbrown/app/assets/javascripts/initializePage.js.erb
Dana Scheider b2a8f69f83 Allow archiving of posts (#2798)
* This commit adds the "archived" attribute to the Article model, which will
enable users to automatically filter archived articles/drafts from appearing
on their dashboard. It also adds an ellipsis menu with a link to archive the
article. I've also moved the Mute Notifications button into the ellipsis menu
as well.

* Add ellipsis menu and make it work

* Fix logic error

* Hide ellipsis menus when you click elsewhere on the body

* Extract function to remove duplication

* Ensure that menu is hidden when the ellipsis button is clicked on an open menu

* Ensure that archiving post button works and that 'archived' param is accepted by the controller

* Enable link to toggle showing/hiding archived articles

* Make 'mute' and 'archive' buttons in ellipsis dropdown list work

* Refactor to make Code Climate happy

* Minor JS refactors
2019-05-13 15:40:52 -04:00

67 lines
1.8 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") {
initializeAllChatButtons();
initializeBaseUserData();
}
initializeAllFollowButts();
initializeReadingListIcons();
initializeSponsorshipVisibility();
if ( document.getElementById("sidebar-additional") ) {
document.getElementById("sidebar-additional").classList.add("showing");
}
}
},1)
initializeBaseTracking();
initializeTouchDevice();
initializeCommentsPage();
initEditorResize();
initLeaveEditorWarning();
initializeArticleDate();
initializeArticleReactions();
initNotifications();
initializeSplitTestTracking();
initializeStylesheetAppend();
initializeCommentDate();
initializeCommentDropdown();
initializeSettings();
initializeFooterMod();
initializeCommentPreview();
initializeAdditionalContentBoxes();
initializeTimeFixer();
initializeDashboardSort();
initializePWAFunctionality();
initializeEllipsisMenu();
initializeArchivedPostFilter();
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();
}
}