How to use the urijs.encode function in urijs

To help you get started, we’ve selected a few urijs examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github sandialabs / slycat / web-server / plugins / slycat-cca / js / parameter-image-scatterplot-copy.js View on Github external
}

    // If we don't have a session for the image hostname, create one.
    var cached_uri = URI(api_root + "projects/" + self.options.model.project + "/cache/" + URI.encode(uri.host() + uri.path()))

    console.log("Attempting to load image from server-side cache...");
    console.log("Loading image " + image.uri + " from server...");

    var xhr = new XMLHttpRequest();
    var api = "/file";
    if(self.options.video_file_extensions.indexOf(uri.suffix()) > -1) {
      api = "/file";
    }

    xhr.image = image;
    xhr.open("GET", api_root + "projects/" + self.options.model.project + "/cache/" + URI.encode(uri.host() + uri.path()), true);
    xhr.responseType = "arraybuffer";

    xhr.onload = function(e){
      //If the image isn't in cache, open an agent session:
      if (this.status == 404) {
        if(!self.login_open)
        {
          self.login_open = true;
          self.remotes.get_remote({
            hostname: uri.hostname(),
            title: "Login to " + uri.hostname(),
            message: "Loading " + uri.pathname(),
            cancel: function() {
              var jFrame = $(".scaffolding." + image.image_class + "[data-uri=\"" + image.uri + "\"]");
              var frame = d3.select(jFrame[0]);
              var related_frames = jFrame.closest('.media-layer').children('.scaffolding').filter(function(_,x){ return URI($(x).attr("data-uri")).hostname() == uri.hostname(); });
github sandialabs / slycat / web-server / plugins / slycat-parameter-image / js / parameter-image-scatterplot.js View on Github external
}

    // If we don't have a session for the image hostname, create one.
    var cached_uri = URI(api_root + "projects/" + self.options.model.project + "/cache/" + URI.encode(uri.host() + uri.path()))

    console.log("Attempting to load image from server-side cache...");
    console.log("Loading image " + image.uri + " from server...");

    var xhr = new XMLHttpRequest();
    var api = "/file";
    if(self.options.video_file_extensions.indexOf(uri.suffix()) > -1) {
      api = "/file";
    }

    xhr.image = image;
    xhr.open("GET", api_root + "projects/" + self.options.model.project + "/cache/" + URI.encode(uri.host() + uri.path()), true);
    xhr.responseType = "arraybuffer";

    xhr.onload = function(e){
      //If the image isn't in cache, open an agent session:
      if (this.status == 404) {
        if(!self.login_open)
        {
          self.login_open = true;
          self.remotes.get_remote({
            hostname: uri.hostname(),
            title: "Login to " + uri.hostname(),
            message: "Loading " + uri.pathname(),
            cancel: function() {
              var jFrame = $(".scaffolding." + image.image_class + "[data-uri=\"" + image.uri + "\"]");
              var frame = d3.select(jFrame[0]);
              var related_frames = jFrame.closest('.media-layer').children('.scaffolding').filter(function(_,x){ return URI($(x).attr("data-uri")).hostname() == uri.hostname(); });
github nicolas-van / sonant-x-live / gui.js View on Github external
var exportURL = function(e)
  {
    // Update song ranges
    updateSongRanges();

    var json = songToJSON(mSong, false);
    var url = "" + new URI().fragment(URI.encode(LZString.compressToBase64(json)));
    showUrlDialog(url);

    return false;
  };
github sandialabs / slycat / web-server / plugins / slycat-cca / js / parameter-image-scatterplot-copy.js View on Github external
success: function(hostname) {
              var xhr = new XMLHttpRequest();
              var api = "/file";
              if(self.options.video_file_extensions.indexOf(uri.suffix()) > -1) {
                api = "/file";
              }

              xhr.image = image;
              //Double encode to avoid cherrypy's auto unencode in the controller
              xhr.open("GET", api_root + "remotes/" + hostname + api + uri.pathname() + "?cache=project&project=" + self.options.model.project + "&key=" + URI.encode(URI.encode(uri.host() + uri.path())), true);
              xhr.responseType = "arraybuffer";
              xhr.onload = function(e) {
                // If we get 404, the remote session no longer exists because it timed-out.
                // If we get 500, there was an internal error communicating to the remote host.
                // Either way, delete the cached session and create a new one.
                if(this.status == 404 || this.status == 500) {
                  self.remotes.delete_remote(uri.hostname());
                  self._open_images(images);
                  return;
                }
                // If we get 400, it means that the session is good and we're
                // communicating with the remote host, but something else went wrong
                // (probably file permissions issues).
                if(this.status == 400) {
                  var message = this.getResponseHeader("slycat-message");
                  var hint = this.getResponseHeader("slycat-hint");
github sandialabs / slycat / web-server / plugins / slycat-parameter-image / js / parameter-image-scatterplot.js View on Github external
success: function(hostname) {
              var xhr = new XMLHttpRequest();
              var api = "/file";
              if(self.options.video_file_extensions.indexOf(uri.suffix()) > -1) {
                api = "/file";
              }

              xhr.image = image;
              //Double encode to avoid cherrypy's auto unencode in the controller
              xhr.open("GET", api_root + "remotes/" + hostname + api + uri.pathname() + "?cache=project&project=" + self.options.model.project + "&key=" + URI.encode(URI.encode(uri.host() + uri.path())), true);
              xhr.responseType = "arraybuffer";
              xhr.onload = function(e) {
                // If we get 404, the remote session no longer exists because it timed-out.
                // If we get 500, there was an internal error communicating to the remote host.
                // Either way, delete the cached session and create a new one.
                if(this.status == 404 || this.status == 500) {
                  self.remotes.delete_remote(uri.hostname());
                  self._open_images(images);
                  return;
                }
                // If we get 400, it means that the session is good and we're
                // communicating with the remote host, but something else went wrong
                // (probably file permissions issues).
                if(this.status == 400) {
                  var message = this.getResponseHeader("slycat-message");
                  var hint = this.getResponseHeader("slycat-hint");
github TerriaJS / terriajs / lib / ReactViews / DataCatalog / DataCatalogItem.jsx View on Github external
render() {
    const item = this.props.item;
    return (
       member.nameInCatalog)
          .join(" → ")}
        btnState={this.getState()}
        onBtnClick={this.onBtnClicked}
        // All things are "removable" - meaning add and remove from workbench,
        //    but only user data is "trashable"
        trashable={this.props.removable}
        onTrashClick={
          this.props.removable
            ? () => {
                this.onTrashClicked();
              }
            : undefined
        }
github TerriaJS / terriajs / lib / ReactViews / Workbench / Controls / ViewingControls.jsx View on Github external
<li>
            <button title="Zoom to data" type="button">
              Zoom To
            </button>
          </li>
          <span>
        
        
          <li>
            
              About This Data
            
          </li>
          <span>
        </span>
        
          <li>
            </li></span>