Sha256: fa66fc4403ff991ea985d6629e6a2345738ca58a78b569f6e050e008d4a66ab7

Contents?: true

Size: 1006 Bytes

Versions: 3

Compression:

Stored size: 1006 Bytes

Contents

//When the page first loads, send the current URL
function dlink_init() {
  //Get parameters
  var params = {};
  var parts = <%= @spec ? "dlink_spec_window" : "window" %>.location.href.replace(/[?&]+([^=&]+)=([^&]*)/gi, function(m,key,value) {
    params[key] = value;
  });

  //Get URL portion
  var url = <%= @spec ? "dlink_spec_window" : "window" %>.location.protocol + '//' + <%= @spec ? "dlink_spec_window" : "window" %>.location.host + <%= @spec ? "dlink_spec_window" : "window" %>.location.pathname;

  //Reset our URL to blank (this dosen't work inside phantomJS)
<% if not @spec %>
  window.history.replaceState({}, "", "/");
<% end %>

  //Notify dlink
  int_dispatch([2, "int_dlink_notify", url, params]);
}

//The window.location struct does not work in phantomJS so we mock it during debugs
<% if @spec %>
  dlink_spec_window = {
    location: {
      protocol: "http:",
      host: "test.com:80",
      pathname: "/test",
      href: "http://test.com:80/test?foo=bar"
    }
  };
<% end %>

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
flok-0.0.105 app/drivers/chrome/src/dlink.js
flok-0.0.103 app/drivers/chrome/src/dlink.js
flok-0.0.102 app/drivers/chrome/src/dlink.js