Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

fix bug when running example.html locally #9

Merged
merged 11 commits into from

2 participants

@aeosynth

on Firefox 8.0a2, when running example.html from my hd, I get an error:
'Operation is not supported', and the example cannot continue.

let me know if you want the style changed or something.

@samyk
Owner

Thanks for the contributions!

Not really, we can drop it and just replace those functions

@samyk samyk closed this
@samyk samyk reopened this
@samyk samyk merged commit f8e1c61 into samyk:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Sep 19, 2011
  1. @aeosynth

    get window.sessionStorage in a try / catch block

    aeosynth authored
    on Firefox 8.0a2, when running example.html from my hd, I get an error:
    'Operation is not supported', and the example cannot continue.
  2. @aeosynth
  3. @aeosynth

    strip whitespace

    aeosynth authored
  4. @aeosynth

    lowercase

    aeosynth authored
  5. @aeosynth
  6. @aeosynth

    semantic tags: b -> strong

    aeosynth authored
  7. @aeosynth

    semantic tags: i -> em

    aeosynth authored
  8. @aeosynth

    remove commented out line

    aeosynth authored
Commits on Sep 20, 2011
  1. @aeosynth

    rm _ec_dump (unused)

    aeosynth authored
  2. @aeosynth

    rm _ec_debug (unused)

    aeosynth authored
  3. @aeosynth

    use jquery

    aeosynth authored
This page is out of date. Refresh to see the latest.
Showing with 26 additions and 54 deletions.
  1. +5 −32 evercookie.js
  2. +21 −22 example.html
View
37 evercookie.js
@@ -67,36 +67,7 @@
/* to turn off CSS history knocking, set _ec_history to 0 */
var _ec_history = 1, // CSS history knocking or not .. can be network intensive
- _ec_tests = 10, //1000
- _ec_debug = 0;
-
-function _ec_dump(arr, level) {
- if (!level) {
- level = 0;
- }
- var dumped_text = "",
- //The padding given at the beginning of the line.
- level_padding = "",
- j, item, value;
- for (j = 0; j < level + 1; j += 1) {
- level_padding += " ";
- }
-
- if (typeof(arr) === "object") { //Array/Objects/NULL
- for (item in arr) {
- value = arr[item];
- if (typeof(value) === "object") { //If it is an Array/Objects/NULL
- dumped_text += level_padding + "'" + item + "' ...\n";
- dumped_text += _ec_dump(value, level + 1);
- } else {
- dumped_text += level_padding + "'" + item + "' => \"" + value + "\"\n";
- }
- }
- } else { //Stings/Chars/Numbers etc.
- dumped_text = "===>" + arr + "<===(" + typeof(arr) + ")";
- }
- return dumped_text;
-}
+ _ec_tests = 10; //1000
function _ec_replace(str, key, value) {
if (str.indexOf("&" + key + "=") > -1 || str.indexOf(key + "=") === 0) {
@@ -150,10 +121,12 @@ var evercookie = (function (window) {
var document = window.document,
Image = window.Image,
localStorage = window.localStorage,
- sessionStorage = window.sessionStorage,
globalStorage = window.globalStorage,
$ = window.jQuery,
swfobject = window.swfobject;
+ try {
+ var sessionStorage = window.sessionStorage;
+ } catch (e) { }
this._class = function () {
// private property
@@ -360,7 +333,7 @@ var evercookie = (function (window) {
};
this.evercookie_lso = function (name, value) {
- var div = document.getElementById("swfcontainer"),
+ var div = $("#swfcontainer"),
flashvars = {},
params = {},
attributes = {};
View
43 example.html
@@ -7,38 +7,37 @@
</head>
<body>
-<pre>
-<script>
+<script>
var val = "573";
var ec = new evercookie();
-
+
getC(1);
-//setTimeout(getC, 500, 1);
-
+
function getC(dont)
{
- ec.get("uid", function(best, all) {
- document.getElementById('idtag').innerHTML = best;
- var txt = document.getElementById('cookies');
- for (var item in all)
- txt.innerHTML += item + ' mechanism: ' + (val == all[item] ? '<b>' + all[item] + '</b>' : all[item]) + '<br>';
- }, dont);
+ ec.get("uid", function(best, all) {
+ document.getElementById('idtag').innerHTML = best;
+ var txt = document.getElementById('cookies');
+ for (var item in all)
+ txt.innerHTML += item + ' mechanism: ' + (val == all[item] ? '<strong>' + all[item] + '</strong>' : all[item]) + '<br>';
+ }, dont);
}
-</script>
- <b>Cookie found:</b> <i>uid</i> = <span id='idtag'>currently not set</span>
-
+</script>
+<pre>
+ <strong>Cookie found:</strong> <em>uid</em> = <span id='idtag'>currently not set</span>
+
Click to create an evercookie. Don't worry, the cookie is a
random number between 1 and 1000, not enough for me to track
you, just enough to test evercookies.
- <input type=button value="Click to create an evercookie" onClick="document.getElementById('idtag').innerHTML = '*creating*'; document.getElementById('cookies').innerHTML = ''; ec.set('uid', val); setTimeout(getC, 1000, 1); ">
-
- <div id='cookies'></div>
+ <input type=button value="Click to create an evercookie" onClick="document.getElementById('idtag').innerHTML = '*creating*'; document.getElementById('cookies').innerHTML = ''; ec.set('uid', val); setTimeout(getC, 1000, 1); ">
+
+ <div id='cookies'></div>
Now, try deleting this "uid" cookie anywhere possible, then
- <input type=button value="Click to rediscover cookies" onClick="document.getElementById('idtag').innerHTML = '*checking*'; document.getElementById('cookies').innerHTML = ''; setTimeout(getC, 300);">
- or
- <input type=button value="Click to rediscover cookies WITHOUT reactivating deleted cookies" onClick="document.getElementById('idtag').innerHTML = '*checking*'; document.getElementById('cookies').innerHTML = ''; setTimeout(getC, 300, 1);">
-
-</PRE>
+ <input type=button value="Click to rediscover cookies" onClick="document.getElementById('idtag').innerHTML = '*checking*'; document.getElementById('cookies').innerHTML = ''; setTimeout(getC, 300);">
+ or
+ <input type=button value="Click to rediscover cookies WITHOUT reactivating deleted cookies" onClick="document.getElementById('idtag').innerHTML = '*checking*'; document.getElementById('cookies').innerHTML = ''; setTimeout(getC, 300, 1);">
+
+</pre>
</body>
</html>
Something went wrong with that request. Please try again.