Remove uses of hasOwnProperty

This commit is contained in:
Tetrakern 2024-05-02 20:35:59 +02:00
parent 5a6f875b12
commit caa3f37839
20 changed files with 36 additions and 39 deletions

View File

@ -1402,7 +1402,7 @@ if ( ! function_exists( 'fictioneer_output_head_critical_scripts' ) ) {
function fictioneer_output_head_critical_scripts() {
// Start HTML ---> ?>
<script id="fictioneer-critical-scripts" data-no-optimize="1" data-no-defer="1" data-no-minify="1">!function(){if("undefined"!=typeof localStorage){const e=localStorage.getItem("fcnLightmode"),t=document.documentElement;let a,o=localStorage.getItem("fcnSiteSettings");if(o&&(o=JSON.parse(o))&&null!==o&&"object"==typeof o){Object.entries(o).forEach((([e,r])=>{switch(e){case"minimal":t.classList.toggle("minimal",r);break;case"darken":a=r>=0?1+r**2:1-r**2,t.style.setProperty("--darken",`(${a} + var(--lightness-offset))`);break;case"saturation":case"font-lightness":case"font-saturation":a=r>=0?1+r**2:1-r**2,t.style.setProperty(`--${e}`,`(${a} + var(--${e}-offset))`);break;case"hue-rotate":a=Number.isInteger(o["hue-rotate"])?o["hue-rotate"]:0,t.style.setProperty("--hue-rotate",`(${a}deg + var(--hue-offset))`);break;default:t.classList.toggle(`no-${e}`,!r)}})),t.dataset.fontWeight=o.hasOwnProperty("font-weight")?o["font-weight"]:"default",t.dataset.theme=o.hasOwnProperty("site-theme")&&!t.dataset.forceChildTheme?o["site-theme"]:"default";let e=getComputedStyle(document.documentElement).getPropertyValue("--theme-color-base").trim().split(" ");const r=o.darken?o.darken:0,s=o.saturation?o.saturation:0,n=o["hue-rotate"]?o["hue-rotate"]:0,l=r>=0?1+r**2:1-r**2;o=s>=0?1+s**2:1-s**2,e=`hsl(${(parseInt(e[0])+n)%360}deg ${(parseInt(e[1])*o).toFixed(2)}% ${(parseInt(e[2])*l).toFixed(2)}%)`,document.querySelector("meta[name=theme-color]").setAttribute("content",e)}e&&(t.dataset.mode="true"==e?"light":"dark")}}();</script>
<script id="fictioneer-critical-scripts" data-no-optimize="1" data-no-defer="1" data-no-minify="1">!function(){if("undefined"!=typeof localStorage){const e=localStorage.getItem("fcnLightmode"),t=document.documentElement;let a,o=localStorage.getItem("fcnSiteSettings");if(o&&(o=JSON.parse(o))&&null!==o&&"object"==typeof o){Object.entries(o).forEach((([e,r])=>{switch(e){case"minimal":t.classList.toggle("minimal",r);break;case"darken":a=r>=0?1+r**2:1-r**2,t.style.setProperty("--darken",`(${a} + var(--lightness-offset))`);break;case"saturation":case"font-lightness":case"font-saturation":a=r>=0?1+r**2:1-r**2,t.style.setProperty(`--${e}`,`(${a} + var(--${e}-offset))`);break;case"hue-rotate":a=Number.isInteger(o["hue-rotate"])?o["hue-rotate"]:0,t.style.setProperty("--hue-rotate",`(${a}deg + var(--hue-offset))`);break;default:t.classList.toggle(`no-${e}`,!r)}})),t.dataset.fontWeight=o["font-weight"]?o["font-weight"]:"default",t.dataset.theme=o["site-theme"]&&!t.dataset.forceChildTheme?o["site-theme"]:"default";let e=getComputedStyle(document.documentElement).getPropertyValue("--theme-color-base").trim().split(" ");const r=o.darken?o.darken:0,s=o.saturation?o.saturation:0,n=o["hue-rotate"]?o["hue-rotate"]:0,l=r>=0?1+r**2:1-r**2;o=s>=0?1+s**2:1-s**2,e=`hsl(${(parseInt(e[0])+n)%360}deg ${(parseInt(e[1])*o).toFixed(2)}% ${(parseInt(e[2])*l).toFixed(2)}%)`,document.querySelector("meta[name=theme-color]").setAttribute("content",e)}e&&(t.dataset.mode="true"==e?"light":"dark")}}();</script>
<?php // <--- End HTML
}
}

View File

@ -1 +1 @@
const fcn_bookshelfTarget=_$$$("ajax-bookshelf-target");function fcn_getBookshelfContent(){return fcn_parseJSON(localStorage.getItem("fcnBookshelfContent"))??{html:{},count:{}}}function fcn_updateBookshelfView(e=null,t=null,o=null,n=!1){let a=fcn_getBookshelfContent();const s=(e=e??fcn_bookshelfTarget.dataset.action)+(t=t??fcn_bookshelfTarget.dataset.page)+(o=o??fcn_bookshelfTarget.dataset.order);if(!a.hasOwnProperty("timestamp")||a.timestamp+6e4<Date.now())return localStorage.removeItem("fcnBookshelfContent"),a={html:{},count:{}},void fcn_fetchBookshelfPart(e,t,o,n);a.hasOwnProperty("html")&&a.html.hasOwnProperty(s)?(fcn_bookshelfTarget.innerHTML=a.html[s],fcn_bookshelfTarget.classList.remove("ajax-in-progress"),fcn_bookshelfTarget.dataset.page=t,_$(".item-number").innerHTML=`(${a.count[e]})`,n&&_$$$("main").scrollIntoView({behavior:"smooth"})):fcn_fetchBookshelfPart(e,t,o,n)}function fcn_browseBookshelfPage(e){fcn_bookshelfTarget.classList.add("ajax-in-progress"),fcn_updateBookshelfView(null,e,null,!0),history.pushState({},"",fcn_buildUrl({tab:fcn_bookshelfTarget.dataset.tab,pg:e,order:fcn_bookshelfTarget.dataset.order}).href)}function fcn_fetchBookshelfPart(e,t,o,n=!1){const a=e+t+o,s=fcn_getBookshelfContent();fcn_ajaxGet({action:e,fcn_fast_ajax:1,page:t,order:o}).then((o=>{o.success?(s.timestamp=Date.now(),s.html[a]=o.data.html,s.count[e]=o.data.count,localStorage.setItem("fcnBookshelfContent",JSON.stringify(s)),fcn_bookshelfTarget.innerHTML=o.data.html,fcn_bookshelfTarget.dataset.page=t,_$(".item-number").innerHTML=`(${o.data.count})`):(fcn_bookshelfTarget.innerHTML="",fcn_bookshelfTarget.appendChild(fcn_buildErrorNotice(o.data.error)))})).catch((e=>{_$(".item-number").innerHTML="",fcn_bookshelfTarget.innerHTML="",fcn_bookshelfTarget.appendChild(fcn_buildErrorNotice(`${e.status}: ${e.statusText}`))})).then((()=>{fcn_bookshelfTarget.classList.remove("ajax-in-progress"),n&&_$$$("main").scrollIntoView({behavior:"smooth"})}))}fcn_bookshelfTarget&&(fcn_theRoot.dataset.ajaxAuth?document.addEventListener("fcnAuthReady",(()=>{fcn_updateBookshelfView()})):fcn_updateBookshelfView()),_$(".bookshelf__list")?.addEventListener("click",(e=>{const t=e.target.closest(".page-numbers[data-page]");t&&fcn_browseBookshelfPage(t.dataset.page)}));
const fcn_bookshelfTarget=_$$$("ajax-bookshelf-target");function fcn_getBookshelfContent(){return fcn_parseJSON(localStorage.getItem("fcnBookshelfContent"))??{html:{},count:{}}}function fcn_updateBookshelfView(e=null,t=null,o=null,n=!1){let a=fcn_getBookshelfContent();const s=(e=e??fcn_bookshelfTarget.dataset.action)+(t=t??fcn_bookshelfTarget.dataset.page)+(o=o??fcn_bookshelfTarget.dataset.order);if(!a.timestamp||a.timestamp+6e4<Date.now())return localStorage.removeItem("fcnBookshelfContent"),a={html:{},count:{}},void fcn_fetchBookshelfPart(e,t,o,n);a.html&&a.html[s]?(fcn_bookshelfTarget.innerHTML=a.html[s],fcn_bookshelfTarget.classList.remove("ajax-in-progress"),fcn_bookshelfTarget.dataset.page=t,_$(".item-number").innerHTML=`(${a.count[e]})`,n&&_$$$("main").scrollIntoView({behavior:"smooth"})):fcn_fetchBookshelfPart(e,t,o,n)}function fcn_browseBookshelfPage(e){fcn_bookshelfTarget.classList.add("ajax-in-progress"),fcn_updateBookshelfView(null,e,null,!0),history.pushState({},"",fcn_buildUrl({tab:fcn_bookshelfTarget.dataset.tab,pg:e,order:fcn_bookshelfTarget.dataset.order}).href)}function fcn_fetchBookshelfPart(e,t,o,n=!1){const a=e+t+o,s=fcn_getBookshelfContent();fcn_ajaxGet({action:e,fcn_fast_ajax:1,page:t,order:o}).then((o=>{o.success?(s.timestamp=Date.now(),s.html[a]=o.data.html,s.count[e]=o.data.count,localStorage.setItem("fcnBookshelfContent",JSON.stringify(s)),fcn_bookshelfTarget.innerHTML=o.data.html,fcn_bookshelfTarget.dataset.page=t,_$(".item-number").innerHTML=`(${o.data.count})`):(fcn_bookshelfTarget.innerHTML="",fcn_bookshelfTarget.appendChild(fcn_buildErrorNotice(o.data.error)))})).catch((e=>{_$(".item-number").innerHTML="",fcn_bookshelfTarget.innerHTML="",fcn_bookshelfTarget.appendChild(fcn_buildErrorNotice(`${e.status}: ${e.statusText}`))})).then((()=>{fcn_bookshelfTarget.classList.remove("ajax-in-progress"),n&&_$$$("main").scrollIntoView({behavior:"smooth"})}))}fcn_bookshelfTarget&&(fcn_theRoot.dataset.ajaxAuth?document.addEventListener("fcnAuthReady",(()=>{fcn_updateBookshelfView()})):fcn_updateBookshelfView()),_$(".bookshelf__list")?.addEventListener("click",(e=>{const t=e.target.closest(".page-numbers[data-page]");t&&fcn_browseBookshelfPage(t.dataset.page)}));

File diff suppressed because one or more lines are too long

2
js/chapter.min.js vendored

File diff suppressed because one or more lines are too long

View File

@ -1 +1 @@
var fcn_checkmarks,fcn_userCheckmarksTimeout;function fcn_initializeCheckmarks(a){const t=a.detail.data.checkmarks;!1!==t&&(Array.isArray(t.data)&&0===t.data.length&&(t.data={}),fcn_checkmarks=t,fcn_updateCheckmarksView(),localStorage.removeItem("fcnBookshelfContent"),_$$("button.checkmark").forEach((a=>{a.addEventListener("click",(a=>{fcn_clickCheckmark(a.currentTarget)}))})))}function fcn_toggleCheckmark(a,t,e=null,c=null,s="toggle"){const r=fcn_getUserData();if(fcn_checkmarks&&r.checkmarks){if(localStorage.removeItem("fcnBookshelfContent"),"toggle"===s&&JSON.stringify(fcn_checkmarks.data[a])!==JSON.stringify(r.checkmarks.data[a]))return fcn_checkmarks=r.checkmarks,fcn_showNotification(fictioneer_tl.notification.checkmarksResynchronized),void fcn_updateCheckmarksView();if(fcn_checkmarks.data.hasOwnProperty(a)||(fcn_checkmarks.data[a]=[]),r.checkmarks.data.hasOwnProperty(a)||(r.checkmarks.data[a]=[]),e&&"progress"===t&&!fcn_checkmarks.data[a].includes(e)&&fcn_checkmarks.data[a].push(e),e&&"chapter"===t)if(!fcn_checkmarks.data[a].includes(e)&&"unset"!==s||"set"===s)fcn_checkmarks.data[a].push(e),c&&(c.classList.add("marked"),c.setAttribute("aria-checked",!0));else{fcn_removeItemOnce(fcn_checkmarks.data[a],e),c&&(c.classList.remove("marked"),c.setAttribute("aria-checked",!1)),fcn_removeItemOnce(fcn_checkmarks.data[a],a);const t=_$('button[data-type="story"]');t&&(t.classList.remove("marked"),t.setAttribute("aria-checked",!1))}if("story"===t){const t=(fcn_checkmarks.data[a].includes(a)||"unset"===s)&&"set"!==s;fcn_checkmarks.data[a]=[],t||(_$$("button.checkmark").forEach((t=>{fcn_checkmarks.data[a].push(parseInt(t.dataset.id))})),fcn_checkmarks.data[a].includes(a)||fcn_checkmarks.data[a].push(a))}fcn_checkmarks.data[a]=fcn_checkmarks.data[a].filter(((a,t,e)=>e.indexOf(a)==t)),r.checkmarks.data[a]=fcn_checkmarks.data[a],r.lastLoaded=0,fcn_setUserData(r),fcn_updateCheckmarksView(),clearTimeout(fcn_userCheckmarksTimeout),fcn_userCheckmarksTimeout=setTimeout((()=>{fcn_updateCheckmarks(a,fcn_checkmarks.data[a])}),fictioneer_ajax.post_debounce_rate)}}function fcn_clickCheckmark(a){fcn_toggleCheckmark(parseInt(a.dataset.storyId),a.dataset.type,parseInt(a.dataset.id),a)}function fcn_updateCheckmarks(a,t=null){t=t||fcn_getUserData().checkmarks.data[a],fcn_ajaxPost({action:"fictioneer_ajax_set_checkmark",fcn_fast_ajax:1,story_id:a,update:t.join(" ")}).then((a=>{a.data.error&&fcn_showNotification(a.data.error,3,"warning")})).catch((a=>{a.status&&a.statusText&&fcn_showNotification(`${a.status}: ${a.statusText}`,5,"warning")}))}function fcn_updateCheckmarksView(){const a=fcn_getUserData(),t=a.checkmarks;if(!t)return;const e=parseInt(fcn_inlineStorage.storyId);if(e){const c=t.data.hasOwnProperty(e)&&t.data[e].includes(e);if(c){let c=!1;_$$("button.checkmark").forEach((a=>{const s=parseInt(a.dataset.id);t.data[e].includes(s)||(t.data[e].push(s),c=!0)})),c&&(a.checkmarks=t,fcn_setUserData(a),fcn_updateCheckmarks(e,t.data[e]))}_$$$("ribbon-read")?.classList.toggle("hidden",!c)}_$$("button.checkmark").forEach((a=>{const e=parseInt(a.dataset.storyId);if(t.data.hasOwnProperty(e)){const c=t.data[e].includes(parseInt(a.dataset.id));a.classList.toggle("marked",c),a.setAttribute("aria-checked",c)}})),_$$(".card").forEach((a=>{const e=parseInt(a.dataset.storyId),c=t.data.hasOwnProperty(e)&&(t.data[e].includes(parseInt(a.dataset.checkId))||t.data[e].includes(e));a.classList.toggle("has-checkmark",c)}))}document.addEventListener("fcnUserDataReady",(a=>{fcn_initializeCheckmarks(a)}));
var fcn_checkmarks,fcn_userCheckmarksTimeout;function fcn_initializeCheckmarks(a){const c=a.detail.data.checkmarks;!1!==c&&(Array.isArray(c.data)&&0===c.data.length&&(c.data={}),fcn_checkmarks=c,fcn_updateCheckmarksView(),localStorage.removeItem("fcnBookshelfContent"),_$$("button.checkmark").forEach((a=>{a.addEventListener("click",(a=>{fcn_clickCheckmark(a.currentTarget)}))})))}function fcn_toggleCheckmark(a,c,t=null,e=null,s="toggle"){const n=fcn_getUserData();if(fcn_checkmarks&&n.checkmarks){if(localStorage.removeItem("fcnBookshelfContent"),"toggle"===s&&JSON.stringify(fcn_checkmarks.data[a])!==JSON.stringify(n.checkmarks.data[a]))return fcn_checkmarks=n.checkmarks,fcn_showNotification(fictioneer_tl.notification.checkmarksResynchronized),void fcn_updateCheckmarksView();if(fcn_checkmarks.data[a]||(fcn_checkmarks.data[a]=[]),n.checkmarks.data[a]||(n.checkmarks.data[a]=[]),t&&"progress"===c&&!fcn_checkmarks.data[a].includes(t)&&fcn_checkmarks.data[a].push(t),t&&"chapter"===c)if(!fcn_checkmarks.data[a].includes(t)&&"unset"!==s||"set"===s)fcn_checkmarks.data[a].push(t),e&&(e.classList.add("marked"),e.setAttribute("aria-checked",!0));else{fcn_removeItemOnce(fcn_checkmarks.data[a],t),e&&(e.classList.remove("marked"),e.setAttribute("aria-checked",!1)),fcn_removeItemOnce(fcn_checkmarks.data[a],a);const c=_$('button[data-type="story"]');c&&(c.classList.remove("marked"),c.setAttribute("aria-checked",!1))}if("story"===c){const c=(fcn_checkmarks.data[a].includes(a)||"unset"===s)&&"set"!==s;fcn_checkmarks.data[a]=[],c||(_$$("button.checkmark").forEach((c=>{fcn_checkmarks.data[a].push(parseInt(c.dataset.id))})),fcn_checkmarks.data[a].includes(a)||fcn_checkmarks.data[a].push(a))}fcn_checkmarks.data[a]=fcn_checkmarks.data[a].filter(((a,c,t)=>t.indexOf(a)==c)),n.checkmarks.data[a]=fcn_checkmarks.data[a],n.lastLoaded=0,fcn_setUserData(n),fcn_updateCheckmarksView(),clearTimeout(fcn_userCheckmarksTimeout),fcn_userCheckmarksTimeout=setTimeout((()=>{fcn_updateCheckmarks(a,fcn_checkmarks.data[a])}),fictioneer_ajax.post_debounce_rate)}}function fcn_clickCheckmark(a){fcn_toggleCheckmark(parseInt(a.dataset.storyId),a.dataset.type,parseInt(a.dataset.id),a)}function fcn_updateCheckmarks(a,c=null){c=c||fcn_getUserData().checkmarks.data[a],fcn_ajaxPost({action:"fictioneer_ajax_set_checkmark",fcn_fast_ajax:1,story_id:a,update:c.join(" ")}).then((a=>{a.data.error&&fcn_showNotification(a.data.error,3,"warning")})).catch((a=>{a.status&&a.statusText&&fcn_showNotification(`${a.status}: ${a.statusText}`,5,"warning")}))}function fcn_updateCheckmarksView(){const a=fcn_getUserData(),c=a.checkmarks;if(!c)return;const t=parseInt(fcn_inlineStorage.storyId);if(t){const e=c.data[t]&&c.data[t].includes(t);if(e){let e=!1;_$$("button.checkmark").forEach((a=>{const s=parseInt(a.dataset.id);c.data[t].includes(s)||(c.data[t].push(s),e=!0)})),e&&(a.checkmarks=c,fcn_setUserData(a),fcn_updateCheckmarks(t,c.data[t]))}_$$$("ribbon-read")?.classList.toggle("hidden",!e)}_$$("button.checkmark").forEach((a=>{const t=parseInt(a.dataset.storyId);if(c.data[t]){const e=c.data[t].includes(parseInt(a.dataset.id));a.classList.toggle("marked",e),a.setAttribute("aria-checked",e)}})),_$$(".card").forEach((a=>{const t=parseInt(a.dataset.storyId),e=c.data[t]&&(c.data[t].includes(parseInt(a.dataset.checkId))||c.data[t].includes(t));a.classList.toggle("has-checkmark",e)}))}document.addEventListener("fcnUserDataReady",(a=>{fcn_initializeCheckmarks(a)}));

10
js/complete.min.js vendored

File diff suppressed because one or more lines are too long

1
js/diff-match-patch.min.js vendored Normal file

File diff suppressed because one or more lines are too long

2
js/follows.min.js vendored
View File

@ -1 +1 @@
const fcn_followsMenuItem=_$$$("follow-menu-button");var fcn_userFollowsTimeout,fcn_follows;function fcn_initializeFollows(o){const t=o.detail.data.follows;!1!==t&&(Array.isArray(t.data)&&0===t.data.length&&(t.data={}),fcn_follows=t,fcn_updateFollowsView(),localStorage.removeItem("fcnBookshelfContent"))}function fcn_toggleFollow(o){const t=fcn_getUserData();if(fcn_follows&&t.follows){if(localStorage.removeItem("fcnBookshelfContent"),JSON.stringify(fcn_follows.data[o])!==JSON.stringify(t.follows.data[o]))return fcn_follows=t.follows,fcn_showNotification(fictioneer_tl.notification.followsResynchronized),void fcn_updateFollowsView();fcn_follows.data.hasOwnProperty(o)?delete fcn_follows.data[o]:fcn_follows.data[o]={story_id:parseInt(o),timestamp:Date.now()},t.follows.data[o]=fcn_follows.data[o],t.lastLoaded=0,fcn_setUserData(t),fcn_updateFollowsView(),clearTimeout(fcn_userFollowsTimeout),fcn_userFollowsTimeout=setTimeout((()=>{fcn_ajaxPost({action:"fictioneer_ajax_toggle_follow",fcn_fast_ajax:1,story_id:o,set:fcn_follows.data.hasOwnProperty(o)}).then((o=>{o.data.error&&fcn_showNotification(o.data.error,5,"warning")})).catch((o=>{429===o.status?fcn_showNotification(fictioneer_tl.notification.slowDown,3,"warning"):o.status&&o.statusText&&fcn_showNotification(`${o.status}: ${o.statusText}`,5,"warning")}))}),fictioneer_ajax.post_debounce_rate)}}function fcn_updateFollowsView(){const o=fcn_getUserData();if(!fcn_follows||!o.follows)return;_$$(".button-follow-story").forEach((o=>{o.classList.toggle("_followed",fcn_follows?.data.hasOwnProperty(o.dataset.storyId))})),_$$(".card").forEach((o=>{o.classList.toggle("has-follow",fcn_follows?.data.hasOwnProperty(o.dataset.storyId))}));const t=parseInt(fcn_follows.new)>0;_$$(".mark-follows-read, .follows-alert-number, .mobile-menu-button").forEach((o=>{o.classList.toggle("_new",t),t>0&&(o.dataset.newCount=fcn_follows.new)}))}function fcn_setupFollowsHTML(){fcn_followsMenuItem.classList.contains("_loaded")||fcn_ajaxGet({action:"fictioneer_ajax_get_follows_notifications",fcn_fast_ajax:1}).then((o=>{if(o.data.html){const t=_$$$("follow-menu-scroll");t&&(t.innerHTML=o.data.html);const n=_$$$("mobile-menu-follows-list");n&&(n.innerHTML=o.data.html),!1===fcn_getUserData().loggedIn&&(fcn_prepareLogin(),fcn_fetchUserData())}})).catch((o=>{429===o.status?fcn_showNotification(fictioneer_tl.notification.slowDown,3,"warning"):o.status&&o.statusText&&fcn_showNotification(`${o.status}: ${o.statusText}`,5,"warning"),_$$$("follow-menu-scroll")?.remove(),_$$$("mobile-menu-follows-list")?.remove()})).then((()=>{fcn_followsMenuItem.classList.add("_loaded")}))}function fcn_markFollowsRead(){if(!fcn_followsMenuItem.classList.contains("_new")||!fcn_followsMenuItem.classList.contains("_loaded"))return;_$$(".mark-follows-read, .follows-alert-number, .follow-item, .mobile-menu-button").forEach((o=>{o.classList.remove("_new")}));const o=fcn_getUserData();o.new=0,o.lastLoaded=0,fcn_setUserData(o),fcn_ajaxPost({action:"fictioneer_ajax_mark_follows_read",fcn_fast_ajax:1}).catch((o=>{o.status&&o.statusText&&fcn_showNotification(`${o.status}: ${o.statusText}`,5,"warning")}))}document.addEventListener("fcnUserDataReady",(o=>{fcn_initializeFollows(o)})),fcn_followsMenuItem?.addEventListener("mouseover",(()=>{fcn_setupFollowsHTML()}),{once:!0}),fcn_followsMenuItem?.addEventListener("focus",(()=>{fcn_setupFollowsHTML()}),{once:!0}),_$('.mobile-menu__frame-button[data-frame-target="follows"]')?.addEventListener("click",(()=>{fcn_setupFollowsHTML()}),{once:!0}),_$$(".button-follow-story").forEach((o=>{o.addEventListener("click",(o=>{fcn_toggleFollow(o.currentTarget.dataset.storyId)}))})),_$$(".mark-follows-read").forEach((o=>{o.addEventListener("click",(()=>{fcn_markFollowsRead()}))}));
const fcn_followsMenuItem=_$$$("follow-menu-button");var fcn_userFollowsTimeout,fcn_follows;function fcn_initializeFollows(o){const t=o.detail.data.follows;!1!==t&&(Array.isArray(t.data)&&0===t.data.length&&(t.data={}),fcn_follows=t,fcn_updateFollowsView(),localStorage.removeItem("fcnBookshelfContent"))}function fcn_toggleFollow(o){const t=fcn_getUserData();if(fcn_follows&&t.follows){if(localStorage.removeItem("fcnBookshelfContent"),JSON.stringify(fcn_follows.data[o])!==JSON.stringify(t.follows.data[o]))return fcn_follows=t.follows,fcn_showNotification(fictioneer_tl.notification.followsResynchronized),void fcn_updateFollowsView();fcn_follows.data[o]?delete fcn_follows.data[o]:fcn_follows.data[o]={story_id:parseInt(o),timestamp:Date.now()},t.follows.data[o]=fcn_follows.data[o],t.lastLoaded=0,fcn_setUserData(t),fcn_updateFollowsView(),clearTimeout(fcn_userFollowsTimeout),fcn_userFollowsTimeout=setTimeout((()=>{fcn_ajaxPost({action:"fictioneer_ajax_toggle_follow",fcn_fast_ajax:1,story_id:o,set:!!fcn_follows.data[o]}).then((o=>{o.data.error&&fcn_showNotification(o.data.error,5,"warning")})).catch((o=>{429===o.status?fcn_showNotification(fictioneer_tl.notification.slowDown,3,"warning"):o.status&&o.statusText&&fcn_showNotification(`${o.status}: ${o.statusText}`,5,"warning")}))}),fictioneer_ajax.post_debounce_rate)}}function fcn_updateFollowsView(){const o=fcn_getUserData();if(!fcn_follows||!o.follows)return;_$$(".button-follow-story").forEach((o=>{o.classList.toggle("_followed",!!fcn_follows?.data[o.dataset.storyId])})),_$$(".card").forEach((o=>{o.classList.toggle("has-follow",!!fcn_follows?.data[o.dataset.storyId])}));const t=parseInt(fcn_follows.new)>0;_$$(".mark-follows-read, .follows-alert-number, .mobile-menu-button").forEach((o=>{o.classList.toggle("_new",t),t>0&&(o.dataset.newCount=fcn_follows.new)}))}function fcn_setupFollowsHTML(){fcn_followsMenuItem.classList.contains("_loaded")||fcn_ajaxGet({action:"fictioneer_ajax_get_follows_notifications",fcn_fast_ajax:1}).then((o=>{if(o.data.html){const t=_$$$("follow-menu-scroll");t&&(t.innerHTML=o.data.html);const n=_$$$("mobile-menu-follows-list");n&&(n.innerHTML=o.data.html),!1===fcn_getUserData().loggedIn&&(fcn_prepareLogin(),fcn_fetchUserData())}})).catch((o=>{429===o.status?fcn_showNotification(fictioneer_tl.notification.slowDown,3,"warning"):o.status&&o.statusText&&fcn_showNotification(`${o.status}: ${o.statusText}`,5,"warning"),_$$$("follow-menu-scroll")?.remove(),_$$$("mobile-menu-follows-list")?.remove()})).then((()=>{fcn_followsMenuItem.classList.add("_loaded")}))}function fcn_markFollowsRead(){if(!fcn_followsMenuItem.classList.contains("_new")||!fcn_followsMenuItem.classList.contains("_loaded"))return;_$$(".mark-follows-read, .follows-alert-number, .follow-item, .mobile-menu-button").forEach((o=>{o.classList.remove("_new")}));const o=fcn_getUserData();o.new=0,o.lastLoaded=0,fcn_setUserData(o),fcn_ajaxPost({action:"fictioneer_ajax_mark_follows_read",fcn_fast_ajax:1}).catch((o=>{o.status&&o.statusText&&fcn_showNotification(`${o.status}: ${o.statusText}`,5,"warning")}))}document.addEventListener("fcnUserDataReady",(o=>{fcn_initializeFollows(o)})),fcn_followsMenuItem?.addEventListener("mouseover",(()=>{fcn_setupFollowsHTML()}),{once:!0}),fcn_followsMenuItem?.addEventListener("focus",(()=>{fcn_setupFollowsHTML()}),{once:!0}),_$('.mobile-menu__frame-button[data-frame-target="follows"]')?.addEventListener("click",(()=>{fcn_setupFollowsHTML()}),{once:!0}),_$$(".button-follow-story").forEach((o=>{o.addEventListener("click",(o=>{fcn_toggleFollow(o.currentTarget.dataset.storyId)}))})),_$$(".mark-follows-read").forEach((o=>{o.addEventListener("click",(()=>{fcn_markFollowsRead()}))}));

View File

@ -1 +1 @@
!function(){if("undefined"!=typeof localStorage){const e=localStorage.getItem("fcnLightmode"),t=document.documentElement;let a,o=localStorage.getItem("fcnSiteSettings");if(o&&(o=JSON.parse(o))&&null!==o&&"object"==typeof o){Object.entries(o).forEach((([e,r])=>{switch(e){case"minimal":t.classList.toggle("minimal",r);break;case"darken":a=r>=0?1+r**2:1-r**2,t.style.setProperty("--darken",`(${a} + var(--lightness-offset))`);break;case"saturation":case"font-lightness":case"font-saturation":a=r>=0?1+r**2:1-r**2,t.style.setProperty(`--${e}`,`(${a} + var(--${e}-offset))`);break;case"hue-rotate":a=Number.isInteger(o["hue-rotate"])?o["hue-rotate"]:0,t.style.setProperty("--hue-rotate",`(${a}deg + var(--hue-offset))`);break;default:t.classList.toggle(`no-${e}`,!r)}})),t.dataset.fontWeight=o.hasOwnProperty("font-weight")?o["font-weight"]:"default",t.dataset.theme=o.hasOwnProperty("site-theme")&&!t.dataset.forceChildTheme?o["site-theme"]:"default";let e=getComputedStyle(document.documentElement).getPropertyValue("--theme-color-base").trim().split(" ");const r=o.darken?o.darken:0,s=o.saturation?o.saturation:0,n=o["hue-rotate"]?o["hue-rotate"]:0,l=r>=0?1+r**2:1-r**2;o=s>=0?1+s**2:1-s**2,e=`hsl(${(parseInt(e[0])+n)%360}deg ${(parseInt(e[1])*o).toFixed(2)}% ${(parseInt(e[2])*l).toFixed(2)}%)`,document.querySelector("meta[name=theme-color]").setAttribute("content",e)}e&&(t.dataset.mode="true"==e?"light":"dark")}}();
!function(){if("undefined"!=typeof localStorage){const e=localStorage.getItem("fcnLightmode"),t=document.documentElement;let a,o=localStorage.getItem("fcnSiteSettings");if(o&&(o=JSON.parse(o))&&null!==o&&"object"==typeof o){Object.entries(o).forEach((([e,r])=>{switch(e){case"minimal":t.classList.toggle("minimal",r);break;case"darken":a=r>=0?1+r**2:1-r**2,t.style.setProperty("--darken",`(${a} + var(--lightness-offset))`);break;case"saturation":case"font-lightness":case"font-saturation":a=r>=0?1+r**2:1-r**2,t.style.setProperty(`--${e}`,`(${a} + var(--${e}-offset))`);break;case"hue-rotate":a=Number.isInteger(o["hue-rotate"])?o["hue-rotate"]:0,t.style.setProperty("--hue-rotate",`(${a}deg + var(--hue-offset))`);break;default:t.classList.toggle(`no-${e}`,!r)}})),t.dataset.fontWeight=o["font-weight"]?o["font-weight"]:"default",t.dataset.theme=o["site-theme"]&&!t.dataset.forceChildTheme?o["site-theme"]:"default";let e=getComputedStyle(document.documentElement).getPropertyValue("--theme-color-base").trim().split(" ");const r=o.darken?o.darken:0,s=o.saturation?o.saturation:0,n=o["hue-rotate"]?o["hue-rotate"]:0,l=r>=0?1+r**2:1-r**2;o=s>=0?1+s**2:1-s**2,e=`hsl(${(parseInt(e[0])+n)%360}deg ${(parseInt(e[1])*o).toFixed(2)}% ${(parseInt(e[2])*l).toFixed(2)}%)`,document.querySelector("meta[name=theme-color]").setAttribute("content",e)}e&&(t.dataset.mode="true"==e?"light":"dark")}}();

2
js/reminders.min.js vendored
View File

@ -1 +1 @@
var fcn_userRemindersTimeout,fcn_reminders;function fcn_initializeReminders(e){const t=e.detail.data.reminders;!1!==t&&(Array.isArray(t.data)&&0===t.data.length&&(t.data={}),fcn_reminders=t,fcn_updateRemindersView(),localStorage.removeItem("fcnBookshelfContent"))}function fcn_toggleReminder(e){const t=fcn_getUserData();if(fcn_reminders&&t.reminders){if(localStorage.removeItem("fcnBookshelfContent"),JSON.stringify(fcn_reminders.data[e])!==JSON.stringify(t.reminders.data[e]))return fcn_reminders=t.reminders,fcn_showNotification(fictioneer_tl.notification.remindersResynchronized),void fcn_updateRemindersView();fcn_reminders.data.hasOwnProperty(e)?delete fcn_reminders.data[e]:fcn_reminders.data[e]={story_id:parseInt(e),timestamp:Date.now()},t.reminders.data[e]=fcn_reminders.data[e],t.lastLoaded=0,fcn_setUserData(t),fcn_updateRemindersView(),clearTimeout(fcn_userRemindersTimeout),fcn_userRemindersTimeout=setTimeout((()=>{fcn_ajaxPost({action:"fictioneer_ajax_toggle_reminder",fcn_fast_ajax:1,story_id:e,set:fcn_reminders.data.hasOwnProperty(e)}).then((e=>{e.data.error&&fcn_showNotification(e.data.error,5,"warning")})).catch((e=>{429===e.status?fcn_showNotification(fictioneer_tl.notification.slowDown,3,"warning"):e.status&&e.statusText&&fcn_showNotification(`${e.status}: ${e.statusText}`,5,"warning")}))}),fictioneer_ajax.post_debounce_rate)}}function fcn_updateRemindersView(){const e=fcn_getUserData();fcn_reminders&&e.reminders&&(_$$(".button-read-later").forEach((e=>{e.classList.toggle("_remembered",fcn_reminders.data.hasOwnProperty(e.dataset.storyId))})),_$$(".card").forEach((e=>{e.classList.toggle("has-reminder",fcn_reminders?.data.hasOwnProperty(e.dataset.storyId))})))}document.addEventListener("fcnUserDataReady",(e=>{fcn_initializeReminders(e)})),_$$(".button-read-later").forEach((e=>{e.addEventListener("click",(e=>{fcn_toggleReminder(e.currentTarget.dataset.storyId)}))}));
var fcn_userRemindersTimeout,fcn_reminders;function fcn_initializeReminders(e){const t=e.detail.data.reminders;!1!==t&&(Array.isArray(t.data)&&0===t.data.length&&(t.data={}),fcn_reminders=t,fcn_updateRemindersView(),localStorage.removeItem("fcnBookshelfContent"))}function fcn_toggleReminder(e){const t=fcn_getUserData();if(fcn_reminders&&t.reminders){if(localStorage.removeItem("fcnBookshelfContent"),JSON.stringify(fcn_reminders.data[e])!==JSON.stringify(t.reminders.data[e]))return fcn_reminders=t.reminders,fcn_showNotification(fictioneer_tl.notification.remindersResynchronized),void fcn_updateRemindersView();fcn_reminders.data[e]?delete fcn_reminders.data[e]:fcn_reminders.data[e]={story_id:parseInt(e),timestamp:Date.now()},t.reminders.data[e]=fcn_reminders.data[e],t.lastLoaded=0,fcn_setUserData(t),fcn_updateRemindersView(),clearTimeout(fcn_userRemindersTimeout),fcn_userRemindersTimeout=setTimeout((()=>{fcn_ajaxPost({action:"fictioneer_ajax_toggle_reminder",fcn_fast_ajax:1,story_id:e,set:!!fcn_reminders.data[e]}).then((e=>{e.data.error&&fcn_showNotification(e.data.error,5,"warning")})).catch((e=>{429===e.status?fcn_showNotification(fictioneer_tl.notification.slowDown,3,"warning"):e.status&&e.statusText&&fcn_showNotification(`${e.status}: ${e.statusText}`,5,"warning")}))}),fictioneer_ajax.post_debounce_rate)}}function fcn_updateRemindersView(){const e=fcn_getUserData();fcn_reminders&&e.reminders&&(_$$(".button-read-later").forEach((e=>{e.classList.toggle("_remembered",!!fcn_reminders.data[e.dataset.storyId])})),_$$(".card").forEach((e=>{e.classList.toggle("has-reminder",!!fcn_reminders.data[e.dataset.storyId])})))}document.addEventListener("fcnUserDataReady",(e=>{fcn_initializeReminders(e)})),_$$(".button-read-later").forEach((e=>{e.addEventListener("click",(e=>{fcn_toggleReminder(e.currentTarget.dataset.storyId)}))}));

2
js/story.min.js vendored
View File

@ -1 +1 @@
var fcn_storyCommentPage=1,fcn_storySettings=fcn_getStorySettings();function fcn_getStorySettings(){let t=fcn_parseJSON(localStorage.getItem("fcnStorySettings"))??fcn_defaultStorySettings();return(!t.hasOwnProperty("timestamp")||t.timestamp<1674770712849)&&(t=fcn_defaultStorySettings(),t.timestamp=Date.now()),fcn_setStorySettings(t),t}function fcn_defaultStorySettings(){return{view:"list",order:"asc",timestamp:1674770712849}}function fcn_setStorySettings(t){"object"==typeof t&&(fcn_storySettings=t,localStorage.setItem("fcnStorySettings",JSON.stringify(t)))}function fcn_applyStorySettings(){"object"==typeof fcn_storySettings&&(_$$("[data-view]").forEach((t=>{t.dataset.view="grid"==fcn_storySettings.view?"grid":"list"})),_$$("[data-order]").forEach((t=>{t.dataset.order="desc"==fcn_storySettings.order?"desc":"asc"})))}function fcn_toggleStoryTab(t){const e=t.closest(".story");e.querySelectorAll(".story__tab-target._current, .story__tabs ._current").forEach((t=>{t.classList.remove("_current")})),e.querySelectorAll(`[data-finder="${t.dataset.target}"]`).forEach((t=>{t.classList.add("_current")})),e.querySelector(".story__tabs").dataset.current=t.dataset.target,t.classList.add("_current")}function fcn_loadStoryComments(t){let e;_$(".load-more-list-item").remove(),_$(".comments-loading-placeholder").classList.remove("hidden"),fcn_ajaxGet({post_id:t.dataset.storyId??fcn_inlineStorage.postId,page:fcn_storyCommentPage},"get_story_comments").then((t=>{t.success?(_$(".fictioneer-comments__list > ul").innerHTML+=t.data.html,fcn_storyCommentPage++):t.data?.error&&(e=fcn_buildErrorNotice(t.data.error))})).catch((t=>{e=fcn_buildErrorNotice(t)})).then((()=>{_$(".comments-loading-placeholder").remove(),e&&_$(".fictioneer-comments__list > ul").appendChild(e)}))}function fcn_startEpubDownload(t,e=0){e>3?t.classList.remove("ajax-in-progress"):fcn_ajaxGet({action:"fictioneer_ajax_download_epub",story_id:t.dataset.storyId}).then((r=>{r.success?(window.location.href=t.href,setTimeout((()=>{t.classList.remove("ajax-in-progress")}),2e3)):setTimeout((()=>{fcn_startEpubDownload(t,e+1)}),2e3)})).catch((e=>{t.classList.remove("ajax-in-progress"),e.status&&e.statusText&&fcn_showNotification(`${e.status}: ${e.statusText}`,5,"warning")}))}fcn_applyStorySettings(),_$$('[data-click-action*="toggle-chapter-order"]').forEach((t=>{t.addEventListener("click",(t=>{fcn_storySettings.order="asc"===t.currentTarget.dataset.order?"desc":"asc",fcn_setStorySettings(fcn_storySettings),fcn_applyStorySettings()}))})),_$$('[data-click-action*="toggle-chapter-view"]').forEach((t=>{t.addEventListener("click",(t=>{fcn_storySettings.view="list"===t.currentTarget.dataset.view?"grid":"list",fcn_setStorySettings(fcn_storySettings),fcn_applyStorySettings()}))})),_$$(".chapter-group__folding-toggle").forEach((t=>{t.addEventListener("click",(t=>{const e=t.currentTarget.closest(".chapter-group[data-folded]");e&&(e.dataset.folded="true"==e.dataset.folded?"false":"true")}))})),_$$(".tabs__item").forEach((t=>{t.addEventListener("click",(t=>{fcn_toggleStoryTab(t.currentTarget)}))})),_$(".comment-section")?.addEventListener("click",(t=>{t.target?.classList.contains("load-more-comments-button")&&fcn_loadStoryComments(t.target)})),_$$('[data-action="download-epub"]').forEach((t=>{t.addEventListener("click",(t=>{t.preventDefault(),t.currentTarget.classList.contains("ajax-in-progress")||(t.currentTarget.classList.add("ajax-in-progress"),fcn_startEpubDownload(t.currentTarget))}))}));
var fcn_storyCommentPage=1,fcn_storySettings=fcn_getStorySettings();function fcn_getStorySettings(){let t=fcn_parseJSON(localStorage.getItem("fcnStorySettings"))??fcn_defaultStorySettings();return t.timestamp<1674770712849&&(t=fcn_defaultStorySettings(),t.timestamp=Date.now()),fcn_setStorySettings(t),t}function fcn_defaultStorySettings(){return{view:"list",order:"asc",timestamp:1674770712849}}function fcn_setStorySettings(t){"object"==typeof t&&(fcn_storySettings=t,localStorage.setItem("fcnStorySettings",JSON.stringify(t)))}function fcn_applyStorySettings(){"object"==typeof fcn_storySettings&&(_$$("[data-view]").forEach((t=>{t.dataset.view="grid"==fcn_storySettings.view?"grid":"list"})),_$$("[data-order]").forEach((t=>{t.dataset.order="desc"==fcn_storySettings.order?"desc":"asc"})))}function fcn_toggleStoryTab(t){const e=t.closest(".story");e.querySelectorAll(".story__tab-target._current, .story__tabs ._current").forEach((t=>{t.classList.remove("_current")})),e.querySelectorAll(`[data-finder="${t.dataset.target}"]`).forEach((t=>{t.classList.add("_current")})),e.querySelector(".story__tabs").dataset.current=t.dataset.target,t.classList.add("_current")}function fcn_loadStoryComments(t){let e;_$(".load-more-list-item").remove(),_$(".comments-loading-placeholder").classList.remove("hidden"),fcn_ajaxGet({post_id:t.dataset.storyId??fcn_inlineStorage.postId,page:fcn_storyCommentPage},"get_story_comments").then((t=>{t.success?(_$(".fictioneer-comments__list > ul").innerHTML+=t.data.html,fcn_storyCommentPage++):t.data?.error&&(e=fcn_buildErrorNotice(t.data.error))})).catch((t=>{e=fcn_buildErrorNotice(t)})).then((()=>{_$(".comments-loading-placeholder").remove(),e&&_$(".fictioneer-comments__list > ul").appendChild(e)}))}function fcn_startEpubDownload(t,e=0){e>3?t.classList.remove("ajax-in-progress"):fcn_ajaxGet({action:"fictioneer_ajax_download_epub",story_id:t.dataset.storyId}).then((r=>{r.success?(window.location.href=t.href,setTimeout((()=>{t.classList.remove("ajax-in-progress")}),2e3)):setTimeout((()=>{fcn_startEpubDownload(t,e+1)}),2e3)})).catch((e=>{t.classList.remove("ajax-in-progress"),e.status&&e.statusText&&fcn_showNotification(`${e.status}: ${e.statusText}`,5,"warning")}))}fcn_applyStorySettings(),_$$('[data-click-action*="toggle-chapter-order"]').forEach((t=>{t.addEventListener("click",(t=>{fcn_storySettings.order="asc"===t.currentTarget.dataset.order?"desc":"asc",fcn_setStorySettings(fcn_storySettings),fcn_applyStorySettings()}))})),_$$('[data-click-action*="toggle-chapter-view"]').forEach((t=>{t.addEventListener("click",(t=>{fcn_storySettings.view="list"===t.currentTarget.dataset.view?"grid":"list",fcn_setStorySettings(fcn_storySettings),fcn_applyStorySettings()}))})),_$$(".chapter-group__folding-toggle").forEach((t=>{t.addEventListener("click",(t=>{const e=t.currentTarget.closest(".chapter-group[data-folded]");e&&(e.dataset.folded="true"==e.dataset.folded?"false":"true")}))})),_$$(".tabs__item").forEach((t=>{t.addEventListener("click",(t=>{fcn_toggleStoryTab(t.currentTarget)}))})),_$(".comment-section")?.addEventListener("click",(t=>{t.target?.classList.contains("load-more-comments-button")&&fcn_loadStoryComments(t.target)})),_$$('[data-action="download-epub"]').forEach((t=>{t.addEventListener("click",(t=>{t.preventDefault(),t.currentTarget.classList.contains("ajax-in-progress")||(t.currentTarget.classList.add("ajax-in-progress"),fcn_startEpubDownload(t.currentTarget))}))}));

View File

@ -57,7 +57,7 @@ function fcn_updateBookshelfView(action = null, page = null, order = null, scrol
// Storage item valid for 60 seconds
if (
! storage.hasOwnProperty('timestamp') ||
! storage['timestamp'] ||
storage['timestamp'] + 60000 < Date.now()
) {
localStorage.removeItem('fcnBookshelfContent');
@ -67,10 +67,7 @@ function fcn_updateBookshelfView(action = null, page = null, order = null, scrol
}
// Check if content already cached
if (
storage.hasOwnProperty('html') &&
storage['html'].hasOwnProperty(htmlKey)
) {
if (storage['html'] && storage['html'][htmlKey]) {
fcn_bookshelfTarget.innerHTML = storage['html'][htmlKey];
fcn_bookshelfTarget.classList.remove('ajax-in-progress');
fcn_bookshelfTarget.dataset.page = page;

View File

@ -1263,7 +1263,7 @@ function fcn_updateSiteTheme(theme) {
_$$('.site-setting-site-theme').forEach(element => {
// Initialize site theme select elements
element.value = fcn_siteSettings.hasOwnProperty('site-theme') ? fcn_siteSettings['site-theme'] : 'default';
element.value = fcn_siteSettings['site-theme'] ? fcn_siteSettings['site-theme'] : 'default';
// Modified?
_$$$('site-setting-theme-reset').classList.toggle('_modified', element.value != 'default');

View File

@ -319,7 +319,7 @@ function fcn_getFormatting() {
}
// Timestamp allows to force resets after script updates (may annoy users)
if (!formatting.hasOwnProperty('timestamp') || formatting['timestamp'] < 1651164557584) {
if (formatting['timestamp'] < 1651164557584) {
formatting = fcn_defaultFormatting();
formatting['timestamp'] = Date.now();
}

View File

@ -97,11 +97,11 @@ function fcn_toggleCheckmark(storyId, type, chapter = null, source = null, mode
}
// Initialize if story is not yet tracked
if (!fcn_checkmarks.data.hasOwnProperty(storyId)) {
if (!fcn_checkmarks.data[storyId]) {
fcn_checkmarks.data[storyId] = [];
}
if (!currentUserData.checkmarks.data.hasOwnProperty(storyId)) {
if (!currentUserData.checkmarks.data[storyId]) {
currentUserData.checkmarks.data[storyId] = [];
}
@ -262,8 +262,7 @@ function fcn_updateCheckmarksView() {
const storyId = parseInt(fcn_inlineStorage.storyId);
if (storyId) {
const completed = checkmarks.data.hasOwnProperty(storyId) &&
checkmarks.data[storyId].includes(storyId);
const completed = checkmarks.data[storyId] && checkmarks.data[storyId].includes(storyId);
// Add missing checkmarks
if (completed) {
@ -293,7 +292,7 @@ function fcn_updateCheckmarksView() {
_$$('button.checkmark').forEach(button => {
const checkStoryId = parseInt(button.dataset.storyId);
if (checkmarks.data.hasOwnProperty(checkStoryId)) {
if (checkmarks.data[checkStoryId]) {
const checked = checkmarks.data[checkStoryId].includes(parseInt(button.dataset.id));
button.classList.toggle('marked', checked);
@ -304,7 +303,7 @@ function fcn_updateCheckmarksView() {
// Update icon and buttons on cards
_$$('.card').forEach(card => {
const cardStoryId = parseInt(card.dataset.storyId);
const force = checkmarks.data.hasOwnProperty(cardStoryId) &&
const force = checkmarks.data[cardStoryId] &&
(
checkmarks.data[cardStoryId].includes(parseInt(card.dataset.checkId)) ||
checkmarks.data[cardStoryId].includes(cardStoryId)

View File

@ -8,7 +8,7 @@ diff_match_patch.prototype.diff_lineMode_=function(a,b,c){var d=this.diff_linesT
diff_match_patch.prototype.diff_bisect_=function(a,b,c){for(var d=a.length,e=b.length,f=Math.ceil((d+e)/2),g=2*f,h=Array(g),l=Array(g),k=0;k<g;k++)h[k]=-1,l[k]=-1;h[f+1]=0;l[f+1]=0;k=d-e;for(var m=0!=k%2,p=0,x=0,w=0,q=0,t=0;t<f&&!((new Date).getTime()>c);t++){for(var v=-t+p;v<=t-x;v+=2){var n=f+v;var r=v==-t||v!=t&&h[n-1]<h[n+1]?h[n+1]:h[n-1]+1;for(var y=r-v;r<d&&y<e&&a.charAt(r)==b.charAt(y);)r++,y++;h[n]=r;if(r>d)x+=2;else if(y>e)p+=2;else if(m&&(n=f+k-v,0<=n&&n<g&&-1!=l[n])){var u=d-l[n];if(r>=
u)return this.diff_bisectSplit_(a,b,r,y,c)}}for(v=-t+w;v<=t-q;v+=2){n=f+v;u=v==-t||v!=t&&l[n-1]<l[n+1]?l[n+1]:l[n-1]+1;for(r=u-v;u<d&&r<e&&a.charAt(d-u-1)==b.charAt(e-r-1);)u++,r++;l[n]=u;if(u>d)q+=2;else if(r>e)w+=2;else if(!m&&(n=f+k-v,0<=n&&n<g&&-1!=h[n]&&(r=h[n],y=f+r-n,u=d-u,r>=u)))return this.diff_bisectSplit_(a,b,r,y,c)}}return[new diff_match_patch.Diff(DIFF_DELETE,a),new diff_match_patch.Diff(DIFF_INSERT,b)]};
diff_match_patch.prototype.diff_bisectSplit_=function(a,b,c,d,e){var f=a.substring(0,c),g=b.substring(0,d);a=a.substring(c);b=b.substring(d);f=this.diff_main(f,g,!1,e);e=this.diff_main(a,b,!1,e);return f.concat(e)};
diff_match_patch.prototype.diff_linesToChars_=function(a,b){function c(a){for(var b="",c=0,g=-1,h=d.length;g<a.length-1;){g=a.indexOf("\n",c);-1==g&&(g=a.length-1);var l=a.substring(c,g+1);(e.hasOwnProperty?e.hasOwnProperty(l):void 0!==e[l])?b+=String.fromCharCode(e[l]):(h==f&&(l=a.substring(c),g=a.length),b+=String.fromCharCode(h),e[l]=h,d[h++]=l);c=g+1}return b}var d=[],e={};d[0]="";var f=4E4,g=c(a);f=65535;var h=c(b);return{chars1:g,chars2:h,lineArray:d}};
diff_match_patch.prototype.diff_linesToChars_=function(a,b){function c(a){for(var b="",c=0,g=-1,h=d.length;g<a.length-1;){g=a.indexOf("\n",c);-1==g&&(g=a.length-1);var l=a.substring(c,g+1);(void 0 !== e[l])?b+=String.fromCharCode(e[l]):(h==f&&(l=a.substring(c),g=a.length),b+=String.fromCharCode(h),e[l]=h,d[h++]=l);c=g+1}return b}var d=[],e={};d[0]="";var f=4E4,g=c(a);f=65535;var h=c(b);return{chars1:g,chars2:h,lineArray:d}};
diff_match_patch.prototype.diff_charsToLines_=function(a,b){for(var c=0;c<a.length;c++){for(var d=a[c][1],e=[],f=0;f<d.length;f++)e[f]=b[d.charCodeAt(f)];a[c][1]=e.join("")}};diff_match_patch.prototype.diff_commonPrefix=function(a,b){if(!a||!b||a.charAt(0)!=b.charAt(0))return 0;for(var c=0,d=Math.min(a.length,b.length),e=d,f=0;c<e;)a.substring(f,e)==b.substring(f,e)?f=c=e:d=e,e=Math.floor((d-c)/2+c);return e};
diff_match_patch.prototype.diff_commonSuffix=function(a,b){if(!a||!b||a.charAt(a.length-1)!=b.charAt(b.length-1))return 0;for(var c=0,d=Math.min(a.length,b.length),e=d,f=0;c<e;)a.substring(a.length-e,a.length-f)==b.substring(b.length-e,b.length-f)?f=c=e:d=e,e=Math.floor((d-c)/2+c);return e};
diff_match_patch.prototype.diff_commonOverlap_=function(a,b){var c=a.length,d=b.length;if(0==c||0==d)return 0;c>d?a=a.substring(c-d):c<d&&(b=b.substring(0,c));c=Math.min(c,d);if(a==b)return c;d=0;for(var e=1;;){var f=a.substring(c-e);f=b.indexOf(f);if(-1==f)return d;e+=f;if(0==f||a.substring(c-e)==b.substring(0,e))d=e,e++}};

View File

@ -82,7 +82,7 @@ function fcn_toggleFollow(storyId) {
}
// Set/Unset follow
if (fcn_follows.data.hasOwnProperty(storyId)) {
if (fcn_follows.data[storyId]) {
delete fcn_follows.data[storyId];
} else {
fcn_follows.data[storyId] = { 'story_id': parseInt(storyId), 'timestamp': Date.now() };
@ -105,7 +105,7 @@ function fcn_toggleFollow(storyId) {
'action': 'fictioneer_ajax_toggle_follow',
'fcn_fast_ajax': 1,
'story_id': storyId,
'set': fcn_follows.data.hasOwnProperty(storyId)
'set': fcn_follows.data[storyId] ? true : false // This must be this verbose!
})
.then(response => {
if (response.data.error) {
@ -144,7 +144,7 @@ function fcn_updateFollowsView() {
_$$('.button-follow-story').forEach(element => {
element.classList.toggle(
'_followed',
fcn_follows?.data.hasOwnProperty(element.dataset.storyId)
fcn_follows?.data[element.dataset.storyId] ? true : false
);
});
@ -152,7 +152,7 @@ function fcn_updateFollowsView() {
_$$('.card').forEach(element => {
element.classList.toggle(
'has-follow',
fcn_follows?.data.hasOwnProperty(element.dataset.storyId)
fcn_follows?.data[element.dataset.storyId] ? true : false
);
});

View File

@ -31,8 +31,8 @@
}
});
root.dataset.fontWeight = settings.hasOwnProperty('font-weight') ? settings['font-weight'] : 'default';
root.dataset.theme = settings.hasOwnProperty('site-theme') && ! root.dataset.forceChildTheme ? settings['site-theme'] : 'default';
root.dataset.fontWeight = settings['font-weight'] ? settings['font-weight'] : 'default';
root.dataset.theme = (settings['site-theme'] && !root.dataset.forceChildTheme) ? settings['site-theme'] : 'default';
let themeColor = getComputedStyle(document.documentElement).getPropertyValue('--theme-color-base').trim().split(' ');

View File

@ -80,7 +80,7 @@ function fcn_toggleReminder(storyId) {
}
// Set/Unset reminder
if (fcn_reminders.data.hasOwnProperty(storyId)) {
if (fcn_reminders.data[storyId]) {
delete fcn_reminders.data[storyId];
} else {
fcn_reminders.data[storyId] = { 'story_id': parseInt(storyId), 'timestamp': Date.now() };
@ -103,7 +103,7 @@ function fcn_toggleReminder(storyId) {
'action': 'fictioneer_ajax_toggle_reminder',
'fcn_fast_ajax': 1,
'story_id': storyId,
'set': fcn_reminders.data.hasOwnProperty(storyId)
'set': fcn_reminders.data[storyId] ? true : false // This must be this verbose!
})
.then(response => {
if (response.data.error) {
@ -142,7 +142,7 @@ function fcn_updateRemindersView() {
_$$('.button-read-later').forEach(element => {
element.classList.toggle(
'_remembered',
fcn_reminders.data.hasOwnProperty(element.dataset.storyId)
fcn_reminders.data[element.dataset.storyId] ? true : false
);
});
@ -150,7 +150,7 @@ function fcn_updateRemindersView() {
_$$('.card').forEach(element => {
element.classList.toggle(
'has-reminder',
fcn_reminders?.data.hasOwnProperty(element.dataset.storyId)
fcn_reminders.data[element.dataset.storyId] ? true : false
);
});
}

View File

@ -26,7 +26,7 @@ function fcn_getStorySettings() {
let settings = fcn_parseJSON(localStorage.getItem('fcnStorySettings')) ?? fcn_defaultStorySettings();
// Timestamp allows to force resets after script updates (may annoy users)
if (!settings.hasOwnProperty('timestamp') || settings['timestamp'] < 1674770712849) {
if (settings['timestamp'] < 1674770712849) {
settings = fcn_defaultStorySettings();
settings['timestamp'] = Date.now();
}