Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion nacc-wordpress-plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* Install: Drop this directory in the "wp-content/plugins/" directory and activate it. You need to specify "[NACC]" in the code section of a page or a post.
* Contributors: BMLTGuy, pjaudiomv, bmltenabled
* Authors: bmltenabled
* Version: 5.0.0
* Version: 5.1.0
* Requires PHP: 8.0
* Requires at least: 5.3
* License: GPL v2 or later
Expand Down
6 changes: 5 additions & 1 deletion nacc2/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,10 @@ You should have received a copy of the GNU General Public License along with the

CHANGELIST
==========
***Version 2.0.1* ** *-November 26, 2025*

- Added localStorage support to automatically save and restore the user's clean date

***Version 2.0.0* ** *-TBD*

- Initial Version
- Initial Version
29 changes: 27 additions & 2 deletions nacc2/nacc.js
Original file line number Diff line number Diff line change
Expand Up @@ -551,7 +551,22 @@ function NACC(inContainerElementID, inStyle, inLang, inTagLayout, inShowSpecialT
if ( !day ) {
year = parseInt(inDay);
};


// Try to load from localStorage if no parameters were supplied
if ( !year && !month && !day && typeof(Storage) !== 'undefined' ) {
var savedDate = localStorage.getItem('nacc_clean_date');
if ( savedDate ) {
try {
var dateObj = JSON.parse(savedDate);
year = parseInt(dateObj.year);
month = parseInt(dateObj.month);
day = parseInt(dateObj.day);
} catch(e) {
// Invalid saved data, ignore it
}
}
};

// We have to have all 3 to do an immediate calculation.
if ( year && month && day ) {
// Set up the popups to reflect the given date.
Expand Down Expand Up @@ -773,7 +788,17 @@ NACC.prototype.calculateCleantime = function(inObject) {
if ( inObject == owner.m_calculation_results_show_special_tags_checkbox ) {
owner.m_keytag_special = !owner.m_keytag_special;
};


// Save the clean date to localStorage when calculate button is clicked
if ( inObject == owner.m_calculate_button && typeof(Storage) !== 'undefined' ) {
var dateToSave = {
year: year,
month: month + 1, // Store as 1-12 for consistency
day: day
};
localStorage.setItem('nacc_clean_date', JSON.stringify(dateToSave));
};

owner.calculate(year, month, day);
};

Expand Down
6 changes: 5 additions & 1 deletion readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Plugin URI: https://wordpress.org/plugins/nacc-wordpress-plugin/
Tags: na, cleantime calculator, nacc, recovery, addiction
Requires PHP: 8.0
Tested up to: 6.8
Stable tag: 5.0.0
Stable tag: 5.1.0
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html

Expand All @@ -30,6 +30,10 @@ That text will be replaced with this cleantime calculator.

== Changelog ==

= 5.1.0 =

* Added localStorage support to automatically save and restore the user's clean date.

= 5.0.0 =

* BREAKING CHANGE: Renamed the `lang` shortcode parameter to `language`. If you are currently using the `lang` parameter in your shortcodes, you will need to update them to use `language` instead.
Expand Down