diff --git a/dev/src/hasher.js b/dev/src/hasher.js index 43b3005..9f0d902 100644 --- a/dev/src/hasher.js +++ b/dev/src/hasher.js @@ -349,6 +349,16 @@ var hasher = (function(window){ } }, + /** + * Set Hash value, generating a new history record. + * Do not dispatch events for this hash change. + */ + setHashQuiet : function(path){ + hasher.changed.active = false; + hasher.setHash.apply(null, arguments); + hasher.changed.active = true; + }, + /** * Set Hash value without keeping previous hash on the history record. * Similar to calling `window.location.replace("#/hash")` but will also work on IE6-7. @@ -373,6 +383,16 @@ var hasher = (function(window){ } }, + /** + * Set Hash value without keeping previous hash on the history record. + * Do not dispatch events for this hash change. + */ + replaceHashQuiet : function(path){ + hasher.changed.active = false; + hasher.replaceHash.apply(null, arguments); + hasher.changed.active = true; + }, + /** * @return {string} Hash value without '#', `hasher.appendHash` and `hasher.prependHash`. */ diff --git a/dist/docs/files.html b/dist/docs/files.html index 31d58c8..16c5d26 100644 --- a/dist/docs/files.html +++ b/dist/docs/files.html @@ -42,7 +42,7 @@

File Index

-

/Users/millermedeiros/Projects/_open_source/Hasher/dist/js/hasher.js

+

/Users/adam/Projects/Hasher/dist/js/hasher.js

@@ -57,7 +57,7 @@

- Documentation generated by JsDoc Toolkit 2.4.0 on Mon Nov 11 2013 15:19:04 GMT-0200 (BRST) + Documentation generated by JsDoc Toolkit 2.4.0 on Mon Oct 27 2014 10:53:46 GMT+0100 (CET) | template based on Steffen Siering jsdoc-simple.

diff --git a/dist/docs/index.html b/dist/docs/index.html index 6847b0b..4c407ab 100644 --- a/dist/docs/index.html +++ b/dist/docs/index.html @@ -63,7 +63,7 @@

hasher

- Documentation generated by JsDoc Toolkit 2.4.0 on Mon Nov 11 2013 15:19:04 GMT-0200 (BRST) + Documentation generated by JsDoc Toolkit 2.4.0 on Mon Oct 27 2014 10:53:46 GMT+0100 (CET) | template based on Steffen Siering jsdoc-simple.
diff --git a/dist/docs/symbolindex.html b/dist/docs/symbolindex.html index 19fa8ae..809447f 100644 --- a/dist/docs/symbolindex.html +++ b/dist/docs/symbolindex.html @@ -210,6 +210,15 @@

Symbol Index

+ + replaceHashQuiet + + + hasher.replaceHashQuiet + + + + separator @@ -228,6 +237,15 @@

Symbol Index

+ + setHashQuiet + + + hasher.setHashQuiet + + + + stop @@ -270,7 +288,7 @@

Symbol Index

- Documentation generated by JsDoc Toolkit 2.4.0 on Mon Nov 11 2013 15:19:04 GMT-0200 (BRST) + Documentation generated by JsDoc Toolkit 2.4.0 on Mon Oct 27 2014 10:53:46 GMT+0100 (CET) | template based on Steffen Siering jsdoc-simple.
diff --git a/dist/docs/symbols/_global_.html b/dist/docs/symbols/_global_.html index 5cfcf3c..a8b2df5 100644 --- a/dist/docs/symbols/_global_.html +++ b/dist/docs/symbols/_global_.html @@ -97,7 +97,7 @@

- Documentation generated by JsDoc Toolkit 2.4.0 on Mon Nov 11 2013 15:19:04 GMT-0200 (BRST) + Documentation generated by JsDoc Toolkit 2.4.0 on Mon Oct 27 2014 10:53:46 GMT+0100 (CET) | template based on Steffen Siering jsdoc-simple.
diff --git a/dist/docs/symbols/hasher.html b/dist/docs/symbols/hasher.html index 51ef828..c9b157a 100644 --- a/dist/docs/symbols/hasher.html +++ b/dist/docs/symbols/hasher.html @@ -136,10 +136,18 @@

Functions

replaceHash +
  • + replaceHashQuiet +
  • +
  • setHash
  • +
  • + setHashQuiet +
  • +
  • stop
  • @@ -172,7 +180,7 @@

    History Manager for rich-media applications. -
    Defined in: hasher.js. +
    Defined in: hasher.js.

    @@ -710,6 +718,45 @@

    + + +
    + +
    +
    <static> +
    + + hasher.replaceHashQuiet(path) + +
    +
    +

    Set Hash value without keeping previous hash on the history record. +Do not dispatch events for this hash change.

    + + +
    + + + + +
    +
    Parameters:
    + +
    + path + +
    +
    + +
    + + + + + + + +
    @@ -754,6 +801,45 @@

    +

    + +
    + +
    +
    <static> +
    + + hasher.setHashQuiet(path) + +
    +
    +

    Set Hash value, generating a new history record. +Do not dispatch events for this hash change.

    + + +
    + + + + +
    +
    Parameters:
    + +
    + path + +
    +
    + +
    + + + + + + + +
    @@ -834,7 +920,7 @@

    - Documentation generated by JsDoc Toolkit 2.4.0 on Mon Nov 11 2013 15:19:04 GMT-0200 (BRST) + Documentation generated by JsDoc Toolkit 2.4.0 on Mon Oct 27 2014 10:53:46 GMT+0100 (CET) | template based on Steffen Siering jsdoc-simple.
    diff --git a/dist/docs/symbols/src/_Users_millermedeiros_Projects__open_source_Hasher_dist_js_hasher.js.html b/dist/docs/symbols/src/_Users_adam_Projects_Hasher_dist_js_hasher.js.html similarity index 91% rename from dist/docs/symbols/src/_Users_millermedeiros_Projects__open_source_Hasher_dist_js_hasher.js.html rename to dist/docs/symbols/src/_Users_adam_Projects_Hasher_dist_js_hasher.js.html index 940c012..399b13e 100644 --- a/dist/docs/symbols/src/_Users_millermedeiros_Projects__open_source_Hasher_dist_js_hasher.js.html +++ b/dist/docs/symbols/src/_Users_adam_Projects_Hasher_dist_js_hasher.js.html @@ -8,7 +8,7 @@
      1 /*!!
       2  * Hasher <http://github.com/millermedeiros/hasher>
       3  * @author Miller Medeiros
    -  4  * @version 1.2.0 (2013/11/11 03:18 PM)
    +  4  * @version 1.2.0 (2014/10/27 10:53 AM)
       5  * Released under the MIT License
       6  */
       7 
    @@ -367,83 +367,103 @@
     360         },
     361 
     362         /**
    -363          * Set Hash value without keeping previous hash on the history record.
    -364          * Similar to calling `window.location.replace("#/hash")` but will also work on IE6-7.
    -365          * @param {...string} path    Hash value without '#'. Hasher will join
    -366          * path segments using `hasher.separator` and prepend/append hash value
    -367          * with `hasher.appendHash` and `hasher.prependHash`
    -368          * @example hasher.replaceHash('lorem', 'ipsum', 'dolor') -> '#/lorem/ipsum/dolor'
    -369          */
    -370         replaceHash : function(path){
    -371             path = _makePath.apply(null, arguments);
    -372             if(path !== _hash){
    -373                 // we should store raw value
    -374                 _registerChange(path, true);
    -375                 if (path === _hash) {
    -376                     // we check if path is still === _hash to avoid error in
    -377                     // case of multiple consecutive redirects [issue #39]
    -378                     if (! hasher.raw) {
    -379                         path = _encodePath(path);
    -380                     }
    -381                     window.location.replace('#' + path);
    -382                 }
    -383             }
    -384         },
    -385 
    -386         /**
    -387          * @return {string} Hash value without '#', `hasher.appendHash` and `hasher.prependHash`.
    -388          */
    -389         getHash : function(){
    -390             //didn't used actual value of the `window.location.hash` to avoid breaking the application in case `window.location.hash` isn't available and also because value should always be synched.
    -391             return _trimHash(_hash);
    -392         },
    -393 
    -394         /**
    -395          * @return {Array.<string>} Hash value split into an Array.
    -396          */
    -397         getHashAsArray : function(){
    -398             return hasher.getHash().split(hasher.separator);
    -399         },
    -400 
    -401         /**
    -402          * Removes all event listeners, stops hasher and destroy hasher object.
    -403          * - IMPORTANT: hasher won't work after calling this method, hasher Object will be deleted.
    -404          */
    -405         dispose : function(){
    -406             hasher.stop();
    -407             hasher.initialized.dispose();
    -408             hasher.stopped.dispose();
    -409             hasher.changed.dispose();
    -410             _frame = hasher = window.hasher = null;
    -411         },
    -412 
    -413         /**
    -414          * @return {string} A string representation of the object.
    -415          */
    -416         toString : function(){
    -417             return '[hasher version="'+ hasher.VERSION +'" hash="'+ hasher.getHash() +'"]';
    -418         }
    -419 
    -420     };
    -421 
    -422     hasher.initialized.memorize = true; //see #33
    -423 
    -424     return hasher;
    -425 
    -426 }(window));
    -427 
    -428 
    -429     return hasher;
    -430 };
    -431 
    -432 if (typeof define === 'function' && define.amd) {
    -433     define(['signals'], factory);
    -434 } else if (typeof exports === 'object') {
    -435     module.exports = factory(require('signals'));
    -436 } else {
    -437     /*jshint sub:true */
    -438     window['hasher'] = factory(window['signals']);
    -439 }
    -440 
    -441 }());
    -442 
    \ No newline at end of file +363 * Set Hash value, generating a new history record. +364 * Do not dispatch events for this hash change. +365 */ +366 setHashQuiet : function(path){ +367 hasher.changed.active = false; +368 hasher.setHash.apply(null, arguments); +369 hasher.changed.active = true; +370 }, +371 +372 /** +373 * Set Hash value without keeping previous hash on the history record. +374 * Similar to calling `window.location.replace("#/hash")` but will also work on IE6-7. +375 * @param {...string} path Hash value without '#'. Hasher will join +376 * path segments using `hasher.separator` and prepend/append hash value +377 * with `hasher.appendHash` and `hasher.prependHash` +378 * @example hasher.replaceHash('lorem', 'ipsum', 'dolor') -> '#/lorem/ipsum/dolor' +379 */ +380 replaceHash : function(path){ +381 path = _makePath.apply(null, arguments); +382 if(path !== _hash){ +383 // we should store raw value +384 _registerChange(path, true); +385 if (path === _hash) { +386 // we check if path is still === _hash to avoid error in +387 // case of multiple consecutive redirects [issue #39] +388 if (! hasher.raw) { +389 path = _encodePath(path); +390 } +391 window.location.replace('#' + path); +392 } +393 } +394 }, +395 +396 /** +397 * Set Hash value without keeping previous hash on the history record. +398 * Do not dispatch events for this hash change. +399 */ +400 replaceHashQuiet : function(path){ +401 hasher.changed.active = false; +402 hasher.replaceHash.apply(null, arguments); +403 hasher.changed.active = true; +404 }, +405 +406 /** +407 * @return {string} Hash value without '#', `hasher.appendHash` and `hasher.prependHash`. +408 */ +409 getHash : function(){ +410 //didn't used actual value of the `window.location.hash` to avoid breaking the application in case `window.location.hash` isn't available and also because value should always be synched. +411 return _trimHash(_hash); +412 }, +413 +414 /** +415 * @return {Array.<string>} Hash value split into an Array. +416 */ +417 getHashAsArray : function(){ +418 return hasher.getHash().split(hasher.separator); +419 }, +420 +421 /** +422 * Removes all event listeners, stops hasher and destroy hasher object. +423 * - IMPORTANT: hasher won't work after calling this method, hasher Object will be deleted. +424 */ +425 dispose : function(){ +426 hasher.stop(); +427 hasher.initialized.dispose(); +428 hasher.stopped.dispose(); +429 hasher.changed.dispose(); +430 _frame = hasher = window.hasher = null; +431 }, +432 +433 /** +434 * @return {string} A string representation of the object. +435 */ +436 toString : function(){ +437 return '[hasher version="'+ hasher.VERSION +'" hash="'+ hasher.getHash() +'"]'; +438 } +439 +440 }; +441 +442 hasher.initialized.memorize = true; //see #33 +443 +444 return hasher; +445 +446 }(window)); +447 +448 +449 return hasher; +450 }; +451 +452 if (typeof define === 'function' && define.amd) { +453 define(['signals'], factory); +454 } else if (typeof exports === 'object') { +455 module.exports = factory(require('signals')); +456 } else { +457 /*jshint sub:true */ +458 window['hasher'] = factory(window['signals']); +459 } +460 +461 }()); +462 \ No newline at end of file diff --git a/dist/js/hasher.js b/dist/js/hasher.js index d8912ea..4a66902 100644 --- a/dist/js/hasher.js +++ b/dist/js/hasher.js @@ -1,7 +1,7 @@ /*!! * Hasher * @author Miller Medeiros - * @version 1.2.0 (2013/11/11 03:18 PM) + * @version 1.2.0 (2014/10/27 10:53 AM) * Released under the MIT License */ @@ -359,6 +359,16 @@ var hasher = (function(window){ } }, + /** + * Set Hash value, generating a new history record. + * Do not dispatch events for this hash change. + */ + setHashQuiet : function(path){ + hasher.changed.active = false; + hasher.setHash.apply(null, arguments); + hasher.changed.active = true; + }, + /** * Set Hash value without keeping previous hash on the history record. * Similar to calling `window.location.replace("#/hash")` but will also work on IE6-7. @@ -383,6 +393,16 @@ var hasher = (function(window){ } }, + /** + * Set Hash value without keeping previous hash on the history record. + * Do not dispatch events for this hash change. + */ + replaceHashQuiet : function(path){ + hasher.changed.active = false; + hasher.replaceHash.apply(null, arguments); + hasher.changed.active = true; + }, + /** * @return {string} Hash value without '#', `hasher.appendHash` and `hasher.prependHash`. */ diff --git a/dist/js/hasher.min.js b/dist/js/hasher.min.js index e76a83f..0e41670 100644 --- a/dist/js/hasher.min.js +++ b/dist/js/hasher.min.js @@ -1,7 +1,7 @@ /*! * Hasher * @author Miller Medeiros - * @version 1.2.0 (2013/11/11 03:18 PM) + * @version 1.2.0 (2014/10/27 10:53 AM) * Released under the MIT License */ -(function(){var a=function(b){var c=(function(k){var p=25,r=k.document,n=k.history,x=b.Signal,f,v,m,F,d,D,t=/#(.*)$/,j=/(\?.*)|(\#.*)/,g=/^\#/,i=(!+"\v1"),B=("onhashchange" in k)&&r.documentMode!==7,e=i&&!B,s=(location.protocol==="file:");function o(G){return String(G||"").replace(/\W/g,"\\$&")}function u(H){if(!H){return""}var G=new RegExp("^"+o(f.prependHash)+"|"+o(f.appendHash)+"$","g");return H.replace(G,"")}function E(){var G=t.exec(f.getURL());var I=(G&&G[1])||"";try{return f.raw?I:decodeURIComponent(I)}catch(H){return I}}function A(){return(d)?d.contentWindow.frameHash:null}function z(){d=r.createElement("iframe");d.src="about:blank";d.style.display="none";r.body.appendChild(d)}function h(){if(d&&v!==A()){var G=d.contentWindow.document;G.open();G.write(""+r.title+'