Changeset 1360900
- Timestamp:
- 02/29/2016 04:43:34 PM (10 years ago)
- Location:
- offline-content
- Files:
-
- 1 deleted
- 4 edited
-
tags/0.4.0/lib/js/sw-manager.js (deleted)
-
trunk/class-wp-offline-content-plugin.php (modified) (1 diff)
-
trunk/lib/js/sw.js (modified) (2 diffs)
-
trunk/readme.txt (modified) (2 diffs)
-
trunk/wp-offline-content.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
offline-content/trunk/class-wp-offline-content-plugin.php
r1358824 r1360900 52 52 private function render($path, $replacements) { 53 53 $contents = file_get_contents($path); 54 $incremental_hash = hash_init('md5'); 55 hash_update($incremental_hash, $contents); 54 56 foreach ($replacements as $key => $replacement) { 55 $contents = str_replace($key, json_encode($replacement), $contents); 57 $value = json_encode($replacement); 58 hash_update($incremental_hash, $value); 59 $contents = str_replace($key, $value, $contents); 56 60 } 61 $version = json_encode(hash_final($incremental_hash)); 62 $contents = str_replace('$version', $version, $contents); 57 63 echo $contents; 58 64 } -
offline-content/trunk/lib/js/sw.js
r1358824 r1360900 5 5 6 6 var wpOfflineContent = self.wpOfflineContent = { 7 8 version: $version, 7 9 8 10 storage: localforage.createInstance({ name: PRIVATE_NAME }), … … 49 51 50 52 update: function () { 51 return this.storage.getItem('resources') 52 .then(currents => this.computeUpdateOrder(currents || {}, this.resources)) 53 .then(order => this.doOrder(order)) 54 .then(() => this.storage.setItem('resources', this.resources)); 53 return this.needsUpdate().then(updateIsNeeded => { 54 if (updateIsNeeded) { 55 return this.storage.getItem('resources') 56 .then(currents => this.computeUpdateOrder(currents || {}, this.resources)) 57 .then(order => this.doOrder(order)) 58 .then(() => this.storage.setItem('resources', this.resources)) 59 .then(() => this.storage.setItem('version', this.version)); 60 } 61 return Promise.resolve(); 62 }); 63 }, 64 65 needsUpdate: function () { 66 return this.storage.getItem('version') 67 .then(lastVersion => Promise.resolve(lastVersion !== this.version)); 55 68 }, 56 69 -
offline-content/trunk/readme.txt
r1358824 r1360900 4 4 Requires at least: 3.7 5 5 Tested up to: 4.4.1 6 Stable tag: 0. 4.06 Stable tag: 0.5.0 7 7 License: GPLv2 or later 8 8 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 44 44 == Change Log == 45 45 46 = 0.5.0 = 47 Prevent undesired updates when used with other service worker supported plugins for WordPress. 48 46 49 = 0.4.0 = 47 50 New smart update algorithm minifies the number of background downloads when adding new content. -
offline-content/trunk/wp-offline-content.php
r1358824 r1360900 4 4 Description: Allow your users to read your content even while offline. 5 5 Plugin URI: https://github.com/delapuente/wp-offline-content 6 Version: 0. 4.06 Version: 0.5.0 7 7 Author: Mozilla 8 8 Author URI: https://www.mozilla.org/
Note: See TracChangeset
for help on using the changeset viewer.