<commit_before>function initBindings () {
  function BookmarkViewModel(title, path, url) {
    var self = this;

    self.title = ko.observable(title);
    self.path = ko.observable(path);
    self.url = ko.observable(url);
    self.icon = ko.computed(function() {
      return "chrome://favicon/" + self.url();
    });
    self.titleAndPath = ko.computed(function() {
      return self.title() + " - " + self.path();
    });
  }

  BookmarkViewModel.prototype.open = function() {
    var self = this;

    chrome.tabs.create({
      url: self.url()
    });
  };

  function AppViewModel(root) {
    var self = this;

    self.pattern = ko.observable("");
    self.bookmarks = ko.computed(function() {
      var result = [];
      self.explore(result, root, self.pattern(), []);
      return result;
    });
  }

  AppViewModel.prototype.exploreFolder = function(result, folder, pattern, pathParts) {
    var self = this;

    if (folder.title) {
      pathParts.push(folder.title);
    }
    for (var i = 0; i < folder.children.length; i++) {
      self.explore(result, folder.children[i], pattern, pathParts.slice(0));
    }
  };

  AppViewModel.prototype.exploreBookmark = function(result, bookmark, pattern, pathParts) {
    var self = this;

    if (bookmark.title.toLowerCase().indexOf(pattern.toLowerCase()) != -1) {
      result.push(
        new BookmarkViewModel(
          bookmark.title,
          pathParts.join("/"),
          bookmark.url));
    }
  };

  AppViewModel.prototype.explore = function(result, bookmarkOrFolder, pattern, pathParts) {
    var self = this;

    if (bookmarkOrFolder.children) {
      self.exploreFolder(result, bookmarkOrFolder, pattern, pathParts);
    } else {
      self.exploreBookmark(result, bookmarkOrFolder, pattern, pathParts);<commit_msg>Added search by url and display of url if bookmark has no name.<commit_after>function initBindings () {
  function BookmarkViewModel(title, path, url) {
    var self = this;

    self.title = ko.observable(title);
    self.path = ko.observable(path);
    self.url = ko.observable(url);
    self.icon = ko.computed(function() {
      return "chrome://favicon/" + self.url();
    });
    self.titleAndPath = ko.computed(function() {
      return self.title() + " - " + self.path();
    });
  }

  BookmarkViewModel.prototype.open = function() {
    var self = this;

    chrome.tabs.create({
      url: self.url()
    });
  };

  function AppViewModel(root) {
    var self = this;

    self.pattern = ko.observable("");
    self.bookmarks = ko.computed(function() {
      var result = [];
      self.explore(result, root, self.pattern(), []);
      return result;
    });
  }

  AppViewModel.prototype.exploreFolder = function(result, folder, pattern, pathParts) {
    var self = this;

    if (folder.title) {
      pathParts.push(folder.title);
    }
    for (var i = 0; i < folder.children.length; i++) {
      self.explore(result, folder.children[i], pattern, pathParts.slice(0));
    }
  };

  AppViewModel.prototype.exploreBookmark = function(result, bookmark, pattern, pathParts) {
    var self = this;
    var lowercasePattern = pattern.toLowerCase();
    if (bookmark.title.toLowerCase().indexOf(lowercasePattern) != -1 ||
        bookmark.url.toLowerCase().indexOf(lowercasePattern) != -1) {
        var displayName = bookmark.title;
        if (!displayName) {
            displayName = bookmark.url;
        }
      result.push(
        new BookmarkViewModel(
          displayName,
          pathParts.join("/"),
          bookmark.url));
    }
  };

  AppViewModel.prototype.explore = function(result, bookmarkOrFolder, pattern, pathParts) {
    var self = this;

    if (bookmarkOrFolder.children) {
      self.exploreFolder(result, bookmarkOrFolder, pattern, pathParts);
    } else {
      self.exploreBookmark(result, bookmarkOrFolder, pattern, pathParts);
{'fraction_non_alphanumeric': 0.14219114219114218, 'fraction_numerical': 0.001813001813001813, 'mean_word_length': 2.842786069651741, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3469142', 'n_tokens_mistral': 1213, 'n_tokens_neox': 1183, 'n_words': 237}