Plugin Directory

Changeset 1360900


Ignore:
Timestamp:
02/29/2016 04:43:34 PM (10 years ago)
Author:
delapuente
Message:

Removing sw-manager.js from 0.4.0 version

Location:
offline-content
Files:
1 deleted
4 edited

Legend:

Unmodified
Added
Removed
  • offline-content/trunk/class-wp-offline-content-plugin.php

    r1358824 r1360900  
    5252    private function render($path, $replacements) {
    5353        $contents = file_get_contents($path);
     54        $incremental_hash = hash_init('md5');
     55        hash_update($incremental_hash, $contents);
    5456        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);
    5660        }
     61        $version = json_encode(hash_final($incremental_hash));
     62        $contents = str_replace('$version', $version, $contents);
    5763        echo $contents;
    5864    }
  • offline-content/trunk/lib/js/sw.js

    r1358824 r1360900  
    55
    66  var wpOfflineContent = self.wpOfflineContent = {
     7
     8    version: $version,
    79
    810    storage: localforage.createInstance({ name: PRIVATE_NAME }),
     
    4951
    5052    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));
    5568    },
    5669
  • offline-content/trunk/readme.txt

    r1358824 r1360900  
    44Requires at least: 3.7
    55Tested up to: 4.4.1
    6 Stable tag: 0.4.0
     6Stable tag: 0.5.0
    77License: GPLv2 or later
    88License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    4444== Change Log ==
    4545
     46= 0.5.0 =
     47Prevent undesired updates when used with other service worker supported plugins for WordPress.
     48
    4649= 0.4.0 =
    4750New smart update algorithm minifies the number of background downloads when adding new content.
  • offline-content/trunk/wp-offline-content.php

    r1358824 r1360900  
    44Description: Allow your users to read your content even while offline.
    55Plugin URI: https://github.com/delapuente/wp-offline-content
    6 Version: 0.4.0
     6Version: 0.5.0
    77Author: Mozilla
    88Author URI: https://www.mozilla.org/
Note: See TracChangeset for help on using the changeset viewer.