<commit_before>dc.ui.Toolbar = Backbone.View.extend({

  id : 'toolbar',

  events : {
    'click #open_viewers' : '_clickOpenViewers',
    'click #size_toggle'  : '_toggleSize'
  },

  MENUS : ['edit', 'sort', 'project', 'publish', 'analyze'],

  constructor : function(options) {
    this._floating = false;
    Backbone.View.call(this, options);
    _.bindAll(this, '_updateSelectedDocuments',
      '_deleteSelectedDocuments', 'editTitle', 'editSource', 'editDescription',
      'editRelatedArticle', 'editAccess', 'openPages', 'openEmbedDialog',
      'openPublicationDateDialog', 'requestDownloadViewers', 'checkFloat',
      '_openTimeline', '_viewEntities', 'editDocumentURL', 'openShareDialog',
      '_markOrder', '_removeFromSelectedProject', '_enableAnalyzeMenu');
    this.sortMenu    = this._createSortMenu();
    this.analyzeMenu = this._createAnalyzeMenu();
    this.publishMenu = this._createPublishMenu();
    if (dc.account) {
      this.editMenu    = this._createEditMenu();
      this.projectMenu = new dc.ui.ProjectMenu({onClick : this._updateSelectedDocuments});
    }
  },

  render : function() {
    var el = $(this.el);
    el.html(JST['workspace/toolbar']({}));
    _.each(this.MENUS, _.bind(function(menu) {
      var view = this[menu + 'Menu'];
      if (view) $('.' + menu + '_menu_container', el).append(view.render().el);
    }, this));
    this.openButton              = this.$('#open_viewers');
    this.floatEl                 = this.$('#floating_toolbar');
    $(window).scroll(_.bind(function(){ _.defer(this.checkFloat); }, this));
    return this;
  },

  // Wrapper function for safely editing an attribute of a specific document.
  edit : function(callback, message) {
    var docs = Documents.selected();
    if (!Documents.allowedToEdit(docs, message)) return;
    return callback.call(this, docs);
  },

  editTitle : function() {
    this.edit(function(docs) {
      var doc = docs[0];
      dc.ui.Dialog.prompt('Title', doc.get('title'), function(title) {
        doc.save({title : title});
        return true;
      }, {mode : 'short_prompt'});
    });
  },

  editDescription : function() {
    this.edit(function(docs) {
      var current = Documents.sharedAttribute(docs, 'description') || '';
      dc.ui.Dialog.prompt('Description', current, function(description) {
        _.each(docs, function(doc) { doc.save({description : description}); });
        return true;
      }, {information : Documents.subtitle(docs.length)});
    });
  },

  editSource : function() {
    this.edit(function(docs) {
      var current = Documents.sharedAttribute(docs, 'source') || '';
      dc.ui.Dialog.prompt('Source', current, function(source) {
        _.each(docs, function(doc) { doc.save({source : source}); });
        return true;
      }, {mode : 'short_prompt', information : Documents.subtitle(docs.length)});
    });
  },

  editRelatedArticle : function() {
    this.edit(function(docs) {
      var current = Documents.sharedAttribute(docs, 'related_article') || '';
      var suffix  = docs.length > 1 ? 'these documents:' : 'this document:';
      dc.ui.Dialog.prompt('Related Article URL', current, function(rel, dialog) {
        rel = Inflector.normalizeUrl(rel);
        if (rel && !dialog.validateUrl(rel)) return false;
        _.each(docs, function(doc) { doc.save({related_article : rel}); });
        return true;
      }, {
        mode        : 'short_prompt',
        information : Documents.subtitle(docs.length),
        description : 'Enter the URL of the article that references ' + suffix
      });
    });
  },

  editDocumentURL : function() {
    this.edit(function(docs) {
      var doc = docs[0];
      dc.ui.Dialog.prompt('Published URL', doc.get('remote_url'), function(url, dialog) {
        url = Inflector.normalizeUrl(url);
        if (url && !dialog.validateUrl(url)) return false;
        doc.save({remote_url : url});
        return true;
      }, {
        mode        : 'short_prompt',
        description : 'Enter the URL of the page on which this document is embedded:'
      });
    });
  },

  editAccess : function() {
    Documents.editAccess(Documents.selected());
  },

  openViewers : function(checkEdit, suffix, afterLoad) {
    if (!Documents.selectedCount) return dc.ui.Dialog.alert('Please select a document to open.');
    var continuation = function(docs) {
      _.each(docs, function(doc){
        var win = doc.openAppropriateVersion(suffix);
        if (afterLoad) {
          win.DV || (win.DV = {});
          win.DV.afterLoad = afterLoad;
        }
      });
    };
    checkEdit ? this.edit(continuation) : continuation(Documents.selected());
  },

  openEmbedDialog : function() {
    var docs = Documents.chosen();
    if (!docs.length) return;
    if (docs.length != 1) return dc.ui.Dialog.alert('Please select a single document in order to create the embed.');
    var doc = docs[0];
    if (!doc.checkAllowedToEdit(Documents.EMBED_FORBIDDEN)) return;
    (new dc.ui.EmbedDialog(doc)).render();
  },

  openShareDialog : function() {
    var docs = Documents.chosen();
    if (!docs.length || !Documents.allowedToEdit(docs)) return;
    dc.app.shareDialog = new dc.ui.ShareDialog({docs: docs, mode: 'custom'});
  },

  openCurrentProject : function() {
    Projects.firstSelected().edit();
  },

  openPublicationDateDialog : function() {
    var docs = Documents.chosen();
    if (!docs.length || !Documents.allowedToEdit(docs)) return;
    new dc.ui.PublicationDateDialog(docs);
  },

  requestDownloadViewers : function() {
    if (dc.account.organization.demo) return dc.ui.Dialog.alert('Demo accounts are not allowed to download viewers. Contact us if you need a full featured account.');
    var docs = Documents.chosen();
    if (docs.length) Documents.downloadViewers(docs);
  },

  reprocessText : function() {
    var docs = Documents.chosen();
    if (!docs.length || !Documents.allowedToEdit(docs)) return;
    var docPart = docs.length == 1 ? 'this document' : 'these documents';
    var message = "Reprocess " + docPart + " to take \
        advantage of improvements to our text extraction tools. Choose \
        \"Force OCR\" (optical character recognition) to ignore any embedded \
        text information and use Tesseract before reprocessing. \
        Are you sure you want to proceed? ";
    var dialog = new dc.ui.Dialog.confirm(message, function() {
      _.each(docs, function(doc){ doc.reprocessText(); });
      return true;
    }, {width: 450});
    var force = $(dialog.make('div', {'class':'minibutton dark'}, 'Force OCR')).bind('click', function() {
      _.each(docs, function(doc){ doc.reprocessText(true); });
      dialog.close();
    });
    dialog.$('.ok').text('Reprocess').before(force);
  },

  checkFloat : function() {
    var open = dc.app.navigation.isOpen('search');
    var floating = open && ($(window).scrollTop() > $(this.el).offset().top - 30);
    if (this._floating == floating) return;
    $(document.body).toggleClass('floating_toolbar', this._floating = floating);
  },

  _updateSelectedDocuments : function(project) {
    var docs    = Documents.selected();
    var removal = project.containsAny(docs);
    removal ? project.removeDocuments(docs) : project.addDocuments(docs);
  },

  _removeFromSelectedProject : function() {
    var docs    = Documents.selected();
    var project = Projects.firstSelected();
    project.removeDocuments(docs);
  },

  _deleteSelectedDocuments : function() {
    Documents.verifyDestroy(Documents.selected());
  },

  // Open up a Timeline. Limit the number of documents to ten. If no documents
  // are selected, choose the first ten docs.
  _openTimeline : function() {
    var docs = Documents.chosen();
    if (!docs.length && Documents.selectedCount) return;
    if (docs.length > 10) return dc.ui.Dialog.alert("You can only view a timeline for ten documents at a time.");
    if (docs.length <= 0) docs = Documents.models.slice(0, 10);
    if (docs.length <= 0) return dc.ui.Dialog.alert("In order to view a timeline, please select some documents.");
    new dc.ui.TimelineDialog(docs);
  },

  _openRelatedDocuments : function() {
    var docs = Documents.chosen();
    if (!docs.length) return;
    if (docs.length != 1) return dc.ui.Dialog.alert("Please select a single document, in order to view related documents.");
    dc.app.searcher.search('related: ' + docs[0].id + '-' + docs[0].toJSON().slug);
  },

  _viewEntities : function() {
    var docs = Documents.chosen();
    if (!docs.length && Documents.selectedCount) return;
    if (!docs.length) return dc.app.navigation.open('entities');
    dc.app.searcher.viewEntities(docs);
  },

  _panel : function() {
    return this._panelEl = this._panelEl || $(this.el).parents('.panel_content')[0];
  },

  _chooseSort : function(e) {
    dc.app.paginator.setSortOrder($(e.target).attr('data-order'));
  },

  _markOrder : function(menu) {
    $('.menu_item', menu.content).removeClass('checked')
      .filter('[data-order="' + dc.app.paginator.sortOrder + '"]').addClass('checked');
  },

  _enableMenuItems : function(menu) {
    var total       = Documents.length;
    var count       = Documents.selectedCount;
    var publicCount = Documents.selectedPublicCount();
    $('.menu_item:not(.plus,.always)', menu.content)
      .toggleClass('disabled', !count)
      .attr('title', count ? '' : 'No documents selected');
    $('.singular', menu.content)
      .toggleClass('disabled', !(count == 1));
    $('.private_only', menu.content)
      .toggleClass('disabled', !count || publicCount > 0).
      attr('title', count && publicCount > 0 ? "already public" : '');
    $('.menu_item.always', menu.content)
      .toggleClass('disabled', !total);
    $('.menu_item.project', menu.content)
      .toggleClass('hidden', !Projects.firstSelected());
  },

  _enableAnalyzeMenu : function(menu) {
    this._enableMenuItems(menu);
    var singular = Documents.selectedCount == 1;
    $('.share_documents', menu.content).text(singular ? 'Share this Document' : 'Share these Documents');
    $('.share_project', menu.content).toggleClass('disabled', !Projects.selectedCount);
  },

  _createPublishMenu : function() {
    var accountItems = [
      {title : 'Embed Document Viewer',          onClick : this.openEmbedDialog,            attrs: {'class': 'singular'}},
      {title : 'Set Publication Date',           onClick : this.openPublicationDateDialog,  attrs: {'class': 'private_only'}},
      {title : 'Download Document Viewer',       onClick : this.requestDownloadViewers}
    ];
    var publicItems = [
      {title : 'Download Original PDF',          onClick : Documents.downloadSelectedPDF},
      {title : 'Download Full Text',             onClick : Documents.downloadSelectedFullText}
    ];
    var items = dc.account ? accountItems.concat(publicItems) : publicItems;
    return new dc.ui.Menu({
      label   : dc.account ? 'Publish' : 'Download',
      onOpen  : this._enableMenuItems,
      items   : items
    });
  },

  _createSortMenu : function() {
    return new dc.ui.Menu({
      label   : 'Sort',
      onOpen  : this._markOrder,
      items   : [
        {title: 'Sort by Relevance',     attrs: {'data-order' : 'score'},      onClick : this._chooseSort},
        {title: 'Sort by Date Uploaded', attrs: {'data-order' : 'created_at'}, onClick : this._chooseSort},
        {title: 'Sort by Title',         attrs: {'data-order' : 'title'},      onClick : this._chooseSort},
        {title: 'Sort by Source',        attrs: {'data-order' : 'source'},     onClick : this._chooseSort},
        {title: 'Sort by Length',        attrs: {'data-order' : 'page_count'}, onClick : this._chooseSort}
      ]
    });
  },

  _createEditMenu : function() {
    return new dc.ui.Menu({
      label   : 'Edit',
      onOpen  : this._enableMenuItems,
      items   : [
        {title : 'Edit Document Information', attrs: {'class' : 'multiple'},        onClick : function(){ dc.ui.DocumentDialog.open(); }},
        {title : 'Title',                     attrs: {'class' : 'singular indent'}, onClick : this.editTitle},
        {title : 'Source',                    attrs: {'class' : 'multiple indent'}, onClick : this.editSource},
        {title : 'Description',               attrs: {'class' : 'multiple indent'}, onClick : this.editDescription},
        {title : 'Access Level',              attrs: {'class' : 'multiple indent'}, onClick : this.editAccess},
        {title : 'Modify Original Document',  attrs: {'class' : 'multiple'},        onClick : _.bind(this.openViewers, this, true, '#pages', null)},
        {title : 'Insert/Replace Pages',      attrs: {'class' : 'multiple indent'}, onClick : _.bind(this.openViewers, this, true, '#pages', this._openInsertEditor)},
        {title : 'Remove Pages',              attrs: {'class' : 'multiple indent'}, onClick : _.bind(this.openViewers, this, true, '#pages', this._openRemoveEditor)},
        {title : 'Reorder Pages',             attrs: {'class' : 'multiple indent'}, onClick : _.bind(this.openViewers, this, true, '#pages', this._openReorderEditor)},
        {title : 'Edit Page Text',            attrs: {'class' : 'multiple indent'}, onClick : _.bind(this.openViewers, this, true, '#text/p1', this._openEditPageTextEditor)},
        {title : 'Reprocess Text',            attrs: {'class' : 'multiple indent'}, onClick : this.reprocessText},
        {title : 'Remove from this Project',  attrs: {'class' : 'multiple project'},onClick : this._removeFromSelectedProject},
        {title : 'Delete Documents',          attrs: {'class' : 'multiple warn'},   onClick : this._deleteSelectedDocuments}
      ]
    });
  },

  _createAnalyzeMenu : function() {
    var publicItems = [
      {title: 'View Entities',          attrs: {'class' : 'always'},   onClick : this._viewEntities},
      {title: 'View Timeline',          attrs: {'class' : 'always'},   onClick : this._openTimeline},
      {title: 'Find Related Documents', attrs: {'class' : 'singular'}, onClick : this._openRelatedDocuments}
    ];
    var accountItems = [
      {title: 'Share these Documents',  attrs: {'class' : 'multiple share_documents'}, onClick : this.openShareDialog },
      {title: 'Share this Project',     attrs: {'class' : 'share_project'},            onClick : this.openCurrentProject }
    ];
    return new dc.ui.Menu({
      label   : 'Analyze',
      onOpen  : this._enableAnalyzeMenu,
      items   : dc.account ? publicItems.concat(accountItems) : publicItems
    });
  },

  _openEditPageTextEditor: function(viewer) {
    _.defer(function(){ viewer.window.dc.app.editor.editPageTextEditor.open(); });
  },

  _openInsertEditor  : function(viewer) {
    _.defer(function(){ viewer.window.dc.app.editor.replacePagesEditor.open(); });
  },

  _openRemoveEditor  : function(viewer) {
    _.defer(function(){ viewer.window.dc.app.editor.removePagesEditor.open(); });
  },

  _openReorderEditor : function(viewer) {
    _.defer(function(){ viewer.window.dc.app.editor.reorderPagesEditor.open(); });
  },

  _clickOpenViewers : function() {
    this.openViewers();
  },

  _toggleSize : function() {
    dc.app.paginator.toggleSize();
  }

});
<commit_msg>re-implementing the edit menu, removing the document modification tools.<commit_after>dc.ui.Toolbar = Backbone.View.extend({

  id : 'toolbar',

  events : {
    'click #open_viewers' : '_clickOpenViewers',
    'click #size_toggle'  : '_toggleSize'
  },

  MENUS : ['edit', 'sort', 'project', 'publish', 'analyze'],

  constructor : function(options) {
    this._floating = false;
    Backbone.View.call(this, options);
    _.bindAll(this, '_updateSelectedDocuments',
      '_deleteSelectedDocuments', 'editTitle', 'editSource', 'editDescription',
      'editRelatedArticle', 'editAccess', 'openPages', 'openEmbedDialog',
      'openPublicationDateDialog', 'requestDownloadViewers', 'checkFloat',
      '_openTimeline', '_viewEntities', 'editPublishedUrl', 'openShareDialog',
      '_markOrder', '_removeFromSelectedProject', '_enableAnalyzeMenu');
    this.sortMenu    = this._createSortMenu();
    this.analyzeMenu = this._createAnalyzeMenu();
    this.publishMenu = this._createPublishMenu();
    if (dc.account) {
      this.editMenu    = this._createEditMenu();
      this.projectMenu = new dc.ui.ProjectMenu({onClick : this._updateSelectedDocuments});
    }
  },

  render : function() {
    var el = $(this.el);
    el.html(JST['workspace/toolbar']({}));
    _.each(this.MENUS, _.bind(function(menu) {
      var view = this[menu + 'Menu'];
      if (view) $('.' + menu + '_menu_container', el).append(view.render().el);
    }, this));
    this.openButton              = this.$('#open_viewers');
    this.floatEl                 = this.$('#floating_toolbar');
    $(window).scroll(_.bind(function(){ _.defer(this.checkFloat); }, this));
    return this;
  },

  // Wrapper function for safely editing an attribute of a specific document.
  edit : function(callback, message) {
    var docs = Documents.selected();
    if (!Documents.allowedToEdit(docs, message)) return;
    return callback.call(this, docs);
  },

  editTitle : function() {
    this.edit(function(docs) {
      var doc = docs[0];
      dc.ui.Dialog.prompt('Title', doc.get('title'), function(title) {
        doc.save({title : title});
        return true;
      }, {mode : 'short_prompt'});
    });
  },

  editDescription : function() {
    this.edit(function(docs) {
      var current = Documents.sharedAttribute(docs, 'description') || '';
      dc.ui.Dialog.prompt('Description', current, function(description) {
        _.each(docs, function(doc) { doc.save({description : description}); });
        return true;
      }, {information : Documents.subtitle(docs.length)});
    });
  },

  editSource : function() {
    this.edit(function(docs) {
      var current = Documents.sharedAttribute(docs, 'source') || '';
      dc.ui.Dialog.prompt('Source', current, function(source) {
        _.each(docs, function(doc) { doc.save({source : source}); });
        return true;
      }, {mode : 'short_prompt', information : Documents.subtitle(docs.length)});
    });
  },

  editRelatedArticle : function() {
    this.edit(function(docs) {
      var current = Documents.sharedAttribute(docs, 'related_article') || '';
      var suffix  = docs.length > 1 ? 'these documents:' : 'this document:';
      dc.ui.Dialog.prompt('Related Article URL', current, function(rel, dialog) {
        rel = Inflector.normalizeUrl(rel);
        if (rel && !dialog.validateUrl(rel)) return false;
        _.each(docs, function(doc) { doc.save({related_article : rel}); });
        return true;
      }, {
        mode        : 'short_prompt',
        information : Documents.subtitle(docs.length),
        description : 'Enter the URL of the article that references ' + suffix
      });
    });
  },

  editPublishedUrl : function() {
    this.edit(function(docs) {
      var current = Documents.sharedAttribute(docs, 'remote_url') || '';
      var suffix  = docs.length > 1 ? 'these documents are' : 'this document is';
      dc.ui.Dialog.prompt('Published URL', current, function(url, dialog) {
        url = Inflector.normalizeUrl(url);
        if (url && !dialog.validateUrl(url)) return false;
        _.each(docs, function(doc) { doc.save({remote_url : url}); });
        return true;
      }, {
        mode        : 'short_prompt',
        information : Documents.subtitle(docs.length),
        description : 'Enter the URL at which ' + suffix + ' embedded:'
      });
    });
  },

  editAccess : function() {
    Documents.editAccess(Documents.selected());
  },

  openViewers : function(checkEdit, suffix, afterLoad) {
    if (!Documents.selectedCount) return dc.ui.Dialog.alert('Please select a document to open.');
    var continuation = function(docs) {
      _.each(docs, function(doc){
        var win = doc.openAppropriateVersion(suffix);
        if (afterLoad) {
          win.DV || (win.DV = {});
          win.DV.afterLoad = afterLoad;
        }
      });
    };
    checkEdit ? this.edit(continuation) : continuation(Documents.selected());
  },

  openEmbedDialog : function() {
    var docs = Documents.chosen();
    if (!docs.length) return;
    if (docs.length != 1) return dc.ui.Dialog.alert('Please select a single document in order to create the embed.');
    var doc = docs[0];
    if (!doc.checkAllowedToEdit(Documents.EMBED_FORBIDDEN)) return;
    (new dc.ui.EmbedDialog(doc)).render();
  },

  openShareDialog : function() {
    var docs = Documents.chosen();
    if (!docs.length || !Documents.allowedToEdit(docs)) return;
    dc.app.shareDialog = new dc.ui.ShareDialog({docs: docs, mode: 'custom'});
  },

  openCurrentProject : function() {
    Projects.firstSelected().edit();
  },

  openPublicationDateDialog : function() {
    var docs = Documents.chosen();
    if (!docs.length || !Documents.allowedToEdit(docs)) return;
    new dc.ui.PublicationDateDialog(docs);
  },

  requestDownloadViewers : function() {
    if (dc.account.organization.demo) return dc.ui.Dialog.alert('Demo accounts are not allowed to download viewers. Contact us if you need a full featured account.');
    var docs = Documents.chosen();
    if (docs.length) Documents.downloadViewers(docs);
  },

  checkFloat : function() {
    var open = dc.app.navigation.isOpen('search');
    var floating = open && ($(window).scrollTop() > $(this.el).offset().top - 30);
    if (this._floating == floating) return;
    $(document.body).toggleClass('floating_toolbar', this._floating = floating);
  },

  _updateSelectedDocuments : function(project) {
    var docs    = Documents.selected();
    var removal = project.containsAny(docs);
    removal ? project.removeDocuments(docs) : project.addDocuments(docs);
  },

  _removeFromSelectedProject : function() {
    var docs    = Documents.selected();
    var project = Projects.firstSelected();
    project.removeDocuments(docs);
  },

  _deleteSelectedDocuments : function() {
    Documents.verifyDestroy(Documents.selected());
  },

  // Open up a Timeline. Limit the number of documents to ten. If no documents
  // are selected, choose the first ten docs.
  _openTimeline : function() {
    var docs = Documents.chosen();
    if (!docs.length && Documents.selectedCount) return;
    if (docs.length > 10) return dc.ui.Dialog.alert("You can only view a timeline for ten documents at a time.");
    if (docs.length <= 0) docs = Documents.models.slice(0, 10);
    if (docs.length <= 0) return dc.ui.Dialog.alert("In order to view a timeline, please select some documents.");
    new dc.ui.TimelineDialog(docs);
  },

  _openRelatedDocuments : function() {
    var docs = Documents.chosen();
    if (!docs.length) return;
    if (docs.length != 1) return dc.ui.Dialog.alert("Please select a single document, in order to view related documents.");
    dc.app.searcher.search('related: ' + docs[0].id + '-' + docs[0].toJSON().slug);
  },

  _viewEntities : function() {
    var docs = Documents.chosen();
    if (!docs.length && Documents.selectedCount) return;
    if (!docs.length) return dc.app.navigation.open('entities');
    dc.app.searcher.viewEntities(docs);
  },

  _panel : function() {
    return this._panelEl = this._panelEl || $(this.el).parents('.panel_content')[0];
  },

  _chooseSort : function(e) {
    dc.app.paginator.setSortOrder($(e.target).attr('data-order'));
  },

  _markOrder : function(menu) {
    $('.menu_item', menu.content).removeClass('checked')
      .filter('[data-order="' + dc.app.paginator.sortOrder + '"]').addClass('checked');
  },

  _enableMenuItems : function(menu) {
    var total       = Documents.length;
    var count       = Documents.selectedCount;
    var publicCount = Documents.selectedPublicCount();
    $('.menu_item:not(.plus,.always)', menu.content)
      .toggleClass('disabled', !count)
      .attr('title', count ? '' : 'No documents selected');
    $('.singular', menu.content)
      .toggleClass('disabled', !(count == 1));
    $('.private_only', menu.content)
      .toggleClass('disabled', !count || publicCount > 0).
      attr('title', count && publicCount > 0 ? "already public" : '');
    $('.menu_item.always', menu.content)
      .toggleClass('disabled', !total);
    $('.menu_item.project', menu.content)
      .toggleClass('hidden', !Projects.firstSelected());
  },

  _enableAnalyzeMenu : function(menu) {
    this._enableMenuItems(menu);
    var singular = Documents.selectedCount == 1;
    $('.share_documents', menu.content).text(singular ? 'Share this Document' : 'Share these Documents');
    $('.share_project', menu.content).toggleClass('disabled', !Projects.selectedCount);
  },

  _createPublishMenu : function() {
    var accountItems = [
      {title : 'Embed Document Viewer',          onClick : this.openEmbedDialog,            attrs: {'class': 'singular'}},
      {title : 'Set Publication Date',           onClick : this.openPublicationDateDialog,  attrs: {'class': 'private_only'}},
      {title : 'Download Document Viewer',       onClick : this.requestDownloadViewers}
    ];
    var publicItems = [
      {title : 'Download Original PDF',          onClick : Documents.downloadSelectedPDF},
      {title : 'Download Full Text',             onClick : Documents.downloadSelectedFullText}
    ];
    var items = dc.account ? accountItems.concat(publicItems) : publicItems;
    return new dc.ui.Menu({
      label   : dc.account ? 'Publish' : 'Download',
      onOpen  : this._enableMenuItems,
      items   : items
    });
  },

  _createSortMenu : function() {
    return new dc.ui.Menu({
      label   : 'Sort',
      onOpen  : this._markOrder,
      items   : [
        {title: 'Sort by Relevance',     attrs: {'data-order' : 'score'},      onClick : this._chooseSort},
        {title: 'Sort by Date Uploaded', attrs: {'data-order' : 'created_at'}, onClick : this._chooseSort},
        {title: 'Sort by Title',         attrs: {'data-order' : 'title'},      onClick : this._chooseSort},
        {title: 'Sort by Source',        attrs: {'data-order' : 'source'},     onClick : this._chooseSort},
        {title: 'Sort by Length',        attrs: {'data-order' : 'page_count'}, onClick : this._chooseSort}
      ]
    });
  },

  _createEditMenu : function() {
    return new dc.ui.Menu({
      label   : 'Edit',
      onOpen  : this._enableMenuItems,
      items   : [
        {title : 'Edit Document Information', attrs: {'class' : 'multiple'},        onClick : function(){ dc.ui.DocumentDialog.open(); }},
        {title : 'Title',                     attrs: {'class' : 'singular indent'}, onClick : this.editTitle},
        {title : 'Source',                    attrs: {'class' : 'multiple indent'}, onClick : this.editSource},
        {title : 'Description',               attrs: {'class' : 'multiple indent'}, onClick : this.editDescription},
        {title : 'Access Level',              attrs: {'class' : 'multiple indent'}, onClick : this.editAccess},
        {title : 'Related Article URL',       attrs: {'class' : 'multiple indent'}, onClick : this.editRelatedArticle},
        {title : 'Published URL',             attrs: {'class' : 'multiple indent'}, onClick : this.editPublishedUrl},
        {title : 'Modify Original Document',  attrs: {'class' : 'multiple'},        onClick : _.bind(this.openViewers, this, true, '#pages', null)},
        {title : 'Remove from this Project',  attrs: {'class' : 'multiple project'},onClick : this._removeFromSelectedProject},
        {title : 'Delete Documents',          attrs: {'class' : 'multiple warn'},   onClick : this._deleteSelectedDocuments}
      ]
    });
  },

  _createAnalyzeMenu : function() {
    var publicItems = [
      {title: 'View Entities',          attrs: {'class' : 'always'},   onClick : this._viewEntities},
      {title: 'View Timeline',          attrs: {'class' : 'always'},   onClick : this._openTimeline},
      {title: 'Find Related Documents', attrs: {'class' : 'singular'}, onClick : this._openRelatedDocuments}
    ];
    var accountItems = [
      {title: 'Share these Documents',  attrs: {'class' : 'multiple share_documents'}, onClick : this.openShareDialog },
      {title: 'Share this Project',     attrs: {'class' : 'share_project'},            onClick : this.openCurrentProject }
    ];
    return new dc.ui.Menu({
      label   : 'Analyze',
      onOpen  : this._enableAnalyzeMenu,
      items   : dc.account ? publicItems.concat(accountItems) : publicItems
    });
  },

  _openEditPageTextEditor: function(viewer) {
    _.defer(function(){ viewer.window.dc.app.editor.editPageTextEditor.open(); });
  },

  _openInsertEditor  : function(viewer) {
    _.defer(function(){ viewer.window.dc.app.editor.replacePagesEditor.open(); });
  },

  _openRemoveEditor  : function(viewer) {
    _.defer(function(){ viewer.window.dc.app.editor.removePagesEditor.open(); });
  },

  _openReorderEditor : function(viewer) {
    _.defer(function(){ viewer.window.dc.app.editor.reorderPagesEditor.open(); });
  },

  _clickOpenViewers : function() {
    this.openViewers();
  },

  _toggleSize : function() {
    dc.app.paginator.toggleSize();
  }

});
<|endoftext|>


<commit_before>// ==UserScript==
// @name         Mitbbs-bot-blocker
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  Manages and blocks bot generated content. Inspired by Smalltalk80's original GM script, http://userscripts-mirror.org/scripts/review/78633
// @author       术版小吃
// @match        http://www.mitbbs.com/*
// @grant        GM_addStyle
// ==/UserScript==

const storageKey = 'mitbbs.blocklist'

function getBlocklist () {
  let blockList = localStorage.getItem(storageKey)
  if (blockList === null) {
    setBlocklist([])
    blockList = localStorage.getItem(storageKey)
  }
  return JSON.parse(blockList)
}

function setBlocklist (idNameList) {
  localStorage.setItem(storageKey, JSON.stringify(idNameList))
}

function getBlockFlag () {
  let blockFlag = localStorage.getItem(storageKey + '.flag')
  if (blockFlag === null) {
    setBlockFlag(0)
    blockFlag = localStorage.getItem(storageKey + '.flag')
  }
  //  js, just being js
  return parseInt(blockFlag)
}

function setBlockFlag (flag) {
  localStorage.setItem(storageKey + '.flag', flag)
}

function ChangePostVisibility () {
  let blockList = getBlocklist()
  let flag = getBlockFlag()
  // if list is not empty
  let counter = 0
  if (blockList) {
    let taolunDiv = document.querySelector('td.taolun_leftright tbody')
    // yeah yeah yeah magic number, whatever
    // this will miss the first one though, nice try langfang coder
    let userIDtdNodeList = taolunDiv.querySelectorAll('td:nth-child(5)')
    userIDtdNodeList.forEach(function (td) {
      // damn, now i miss jquery/zepto
      let id = td.querySelector('a.news') ? td.querySelector('a.news').innerHTML : null
      //  yeah, nested if statements
      if (blockList.indexOf(id) > -1) {
        if (flag) {
          td.parentNode.style.display = 'none'
          counter += 1
        } else {
          td.parentNode.style.display = ''
        }
      }
    })
    counter = flag ? counter : 0
    document.getElementById('blockCounter').innerHTML = counter
  }
}

function toggleBlockedContent () {
  document.getElementById('isBlocking').checked ? setBlockFlag(1) : setBlockFlag(0)
  ChangePostVisibility()
}

function changeBlockListVisibility () {
  let notVisible = document.getElementById('blockListPop').style.display === 'none'
  if (notVisible) {
    document.getElementById('blockListInput').value = getBlocklist().join()
    document.getElementById('blockListPop').style.display = ''
  } else {
    document.getElementById('blockListPop').style.display = 'none'
  }
}

function updateBlockList () {
  let newBlockList = document.getElementById('blockListInput').value
  //  remove line break, space, trailing comma
  newBlockList = newBlockList.replace(/(\r\n|\n|\r)/gm, '').replace(/\s/g, '').replace(/,+$/, '')
  newBlockList = newBlockList.split(',')
  setBlocklist(newBlockList)

  // re-filter existing content
  toggleBlockedContent()
}

function hideBlockList () {
  document.getElementById('blockListPop').style.display = 'none'
}

function pageOnLoad () {
  let baseUrl = window.location.href
  let isArticlePage = baseUrl.indexOf('article') > -1
  //  build blocker control gui
  let blockerDiv = document.createElement('div')
  blockerDiv.innerHTML = '<button id="showBlocklist">黑名单</button><input type="checkbox" id="isBlocking" />'
  blockerDiv.style.cssText = 'position:fixed; bottom:2em; right:0.5em; width:9em; padding:0.5em; border-radius:0.25em; background-color:#D7EAF9; box-shadow:2px 2px 4px 0px rgba(0,0,0,0.5); text-align:center; cursor:pointer;'
  document.body.appendChild(blockerDiv)

  document.getElementById('showBlocklist').addEventListener('click', changeBlockListVisibility)
  document.getElementById('blockCounter').style.cssText = 'padding:0 4px; font-weight:bold'
  document.getElementById('isBlocking').addEventListener('change', toggleBlockedContent)

  //  block list
  let blockListDiv = document.createElement('div')
  blockListDiv.setAttribute('id', 'blockListPop')
  blockListDiv.innerHTML = '修改ID，用逗号分隔,大小写敏感！' +
    '
' +
    '<textarea rows="10" cols="40" id="blockListInput"></textarea>' +
    '
' +
    '<button id="updateBlockList">Update</button><button id="closePop">Close</button>'
  blockListDiv.style.cssText = 'position:fixed; bottom:5.3em; right:0.5em; padding:0.5em; border-radius:0.25em; background-color:#D7EAF9; box-shadow:2px 2px 4px 0px rgba(0,0,0,0.5); text-align:center; display:none'
  document.body.appendChild(blockListDiv)

  document.getElementById('updateBlockList').addEventListener('click', updateBlockList)
  document.getElementById('closePop').addEventListener('click', hideBlockList)
}

pageOnLoad()
<commit_msg>1. Add website match for https<commit_after>// ==UserScript==
// @name         Mitbbs-bot-blocker
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  Manages and blocks bot generated content. Inspired by Smalltalk80's original GM script, http://userscripts-mirror.org/scripts/review/78633
// @author       术版小吃
// @match        http://www.mitbbs.com/*
// @match        https://www.mitbbs.com/*
// @grant        GM_addStyle
// ==/UserScript==

const storageKey = 'mitbbs.blocklist'

function getBlocklist () {
  let blockList = localStorage.getItem(storageKey)
  if (blockList === null) {
    setBlocklist([])
    blockList = localStorage.getItem(storageKey)
  }
  return JSON.parse(blockList)
}

function setBlocklist (idNameList) {
  localStorage.setItem(storageKey, JSON.stringify(idNameList))
}

function getBlockFlag () {
  let blockFlag = localStorage.getItem(storageKey + '.flag')
  if (blockFlag === null) {
    setBlockFlag(0)
    blockFlag = localStorage.getItem(storageKey + '.flag')
  }
  //  js, just being js
  return parseInt(blockFlag)
}

function setBlockFlag (flag) {
  localStorage.setItem(storageKey + '.flag', flag)
}

function ChangePostVisibility () {
  let blockList = getBlocklist()
  let flag = getBlockFlag()
  // if list is not empty
  let counter = 0
  if (blockList) {
    let taolunDiv = document.querySelector('td.taolun_leftright tbody')
    // yeah yeah yeah magic number, whatever
    // this will miss the first one though, nice try langfang coder
    let userIDtdNodeList = taolunDiv.querySelectorAll('td:nth-child(5)')
    userIDtdNodeList.forEach(function (td) {
      // damn, now i miss jquery/zepto
      let id = td.querySelector('a.news') ? td.querySelector('a.news').innerHTML : null
      //  yeah, nested if statements
      if (blockList.indexOf(id) > -1) {
        if (flag) {
          td.parentNode.style.display = 'none'
          counter += 1
        } else {
          td.parentNode.style.display = ''
        }
      }
    })
    counter = flag ? counter : 0
    document.getElementById('blockCounter').innerHTML = counter
  }
}

function toggleBlockedContent () {
  document.getElementById('isBlocking').checked ? setBlockFlag(1) : setBlockFlag(0)
  ChangePostVisibility()
}

function changeBlockListVisibility () {
  let notVisible = document.getElementById('blockListPop').style.display === 'none'
  if (notVisible) {
    document.getElementById('blockListInput').value = getBlocklist().join()
    document.getElementById('blockListPop').style.display = ''
  } else {
    document.getElementById('blockListPop').style.display = 'none'
  }
}

function updateBlockList () {
  let newBlockList = document.getElementById('blockListInput').value
  //  remove line break, space, trailing comma
  newBlockList = newBlockList.replace(/(\r\n|\n|\r)/gm, '').replace(/\s/g, '').replace(/,+$/, '')
  newBlockList = newBlockList.split(',')
  setBlocklist(newBlockList)

  // re-filter existing content
  toggleBlockedContent()
}

function hideBlockList () {
  document.getElementById('blockListPop').style.display = 'none'
}

function pageOnLoad () {
  let baseUrl = window.location.href
  let isArticlePage = baseUrl.indexOf('article') > -1
  //  build blocker control gui
  let blockerDiv = document.createElement('div')
  blockerDiv.innerHTML = '<button id="showBlocklist">黑名单</button><input type="checkbox" id="isBlocking" />'
  blockerDiv.style.cssText = 'position:fixed; bottom:2em; right:0.5em; width:9em; padding:0.5em; border-radius:0.25em; background-color:#D7EAF9; box-shadow:2px 2px 4px 0px rgba(0,0,0,0.5); text-align:center; cursor:pointer;'
  document.body.appendChild(blockerDiv)

  document.getElementById('showBlocklist').addEventListener('click', changeBlockListVisibility)
  document.getElementById('blockCounter').style.cssText = 'padding:0 4px; font-weight:bold'
  document.getElementById('isBlocking').addEventListener('change', toggleBlockedContent)

  //  block list
  let blockListDiv = document.createElement('div')
  blockListDiv.setAttribute('id', 'blockListPop')
  blockListDiv.innerHTML = '修改ID，用逗号分隔,大小写敏感！' +
    '
' +
    '<textarea rows="10" cols="40" id="blockListInput"></textarea>' +
    '
' +
    '<button id="updateBlockList">Update</button><button id="closePop">Close</button>'
  blockListDiv.style.cssText = 'position:fixed; bottom:5.3em; right:0.5em; padding:0.5em; border-radius:0.25em; background-color:#D7EAF9; box-shadow:2px 2px 4px 0px rgba(0,0,0,0.5); text-align:center; display:none'
  document.body.appendChild(blockListDiv)

  document.getElementById('updateBlockList').addEventListener('click', updateBlockList)
  document.getElementById('closePop').addEventListener('click', hideBlockList)
}

pageOnLoad()
<|endoftext|>


<commit_before>var conf = {
    lang : 'en',
    ver: '',
    //lang : 'pl',
    text : {
        pl : {
            title : 'Kulki',
            score : 'PUNKTY',
            game_over : 'Koniec gry',
            clear: 'Czyść',
            alternative : 'Aby zagrać w grę musisz posiadać nową wersję przeglądarki (rekomendowane przeglądarki: firefox lub chrome)',
        },
        en : {
            title : 'Ball lines',
            score : 'SCORE',
            game_over : 'Game over',
            clear: 'Clear',
            alternative : 'In order to play with this game, You have to install a new web browser (recommend: firefox or chrome)',
        }
    },
    color :{
        theme_logo_blue: '#b1ccdd',
        theme_black: '#050505',
        theme_light_black: '#191919',
        theme_logo_red: '#ff5050',
        theme_light_blue: '#d9d9d9',
        theme_a_blue:'#174f82'
    },

    color_ball :[
         '#FFFF00', //0  yellow
         '#FF0000',  //1  red
         '#0000FF',  //2  blue
         '#00FF00', //3  gren
         '#00FFFF', //4  light blue
         '#000000', //5  black
         '#bf80ff', //6 violet

         '#FF00FF', //7  light red
         '#909090', //8 grey
         '#99FF99' //9  light green -- kiepsko widoczny kolor!!!!
    ],
    settings : {
        sizeLoader : 1,
        //ticPadding : 4,
        ticPadding : 10,
        ticPaddingMark : 5,
        ticPaddingX : 14,
        ticWidth : 6,
        ticWidthX : 4
    },
    action :{
        rows : 9,
        cols : 9,
        len : 5,
        blank : -1,
        balls_color_no : 6, //dotyczy kolorow, 8-trudno wygrac
        balls_next_no : 3,
        balls_next_no_variety: 0,
        balls_init_no : 5,
        score : 0
    }

};

var counter = 0;

if (Modernizr.canvas ){

    window.addEventListener("load", function() {
        if(typeof  lang !==  'undefined' ){
            conf.lang =  lang;
        }

        if(typeof  balllinesV2 !==  'undefined' ){
            conf.ver = '2';
            conf.action.rows = 8;
            conf.action.cols = 8;
            conf.action.len = 4;
            conf.action.balls_next_no = 4;
            conf.action.balls_next_no_variety = 3;
            conf.action.balls_color_no = 7;
            conf.text.pl.title = 'Kulki v2';
            conf.text.en.title = 'Ball lines v2';
            var jewelProto = document.getElementById(  'square-size-checkers' );
            var rect = jewelProto.getBoundingClientRect();
            conf.settings.ticSize = rect.width;

            var balllines_score =  JSON.parse(localStorage.getItem('balllines_score2' ));
        }else if(typeof  balllinesV3 !==  'undefined' ){
            conf.ver = '3';
            conf.action.rows = 10;
            conf.action.cols = 10;
            conf.action.len = 6;
            conf.action.balls_color_no = 7;
	          conf.action.balls_next_no = 2;
            conf.action.balls_next_no_variety = 3;
            conf.text.pl.title = 'Kulki v3';
            conf.text.en.title = 'Ball lines v3';
            var jewelProto = document.getElementById(   'square-size-ten'  );
            var rect = jewelProto.getBoundingClientRect();
            conf.settings.ticSize = rect.width;

            var balllines_score =  JSON.parse(localStorage.getItem('balllines_score3' ));
        }else{
            conf.ver = '1';
            var jewelProto = document.getElementById(  'square-size'  );
            var rect = jewelProto.getBoundingClientRect();
            conf.settings.ticSize = rect.width;

            var balllines_score =  JSON.parse(localStorage.getItem('balllines_score1' ));
        }

        if(balllines_score){
          conf.action.score = balllines_score;
          //localStorage.removeItem('balllines_score');
        }else{
          conf.action.score = 0;
        }

        display.initialize( conf );

    }, false);

}else{
    alert(  conf.text['pl'].alternative +  " / " +    conf.text['en'].alternative );
}
<commit_msg>change balls_next_no_variety<commit_after>var conf = {
    lang : 'en',
    ver: '',
    //lang : 'pl',
    text : {
        pl : {
            title : 'Kulki',
            score : 'PUNKTY',
            game_over : 'Koniec gry',
            clear: 'Czyść',
            alternative : 'Aby zagrać w grę musisz posiadać nową wersję przeglądarki (rekomendowane przeglądarki: firefox lub chrome)',
        },
        en : {
            title : 'Ball lines',
            score : 'SCORE',
            game_over : 'Game over',
            clear: 'Clear',
            alternative : 'In order to play with this game, You have to install a new web browser (recommend: firefox or chrome)',
        }
    },
    color :{
        theme_logo_blue: '#b1ccdd',
        theme_black: '#050505',
        theme_light_black: '#191919',
        theme_logo_red: '#ff5050',
        theme_light_blue: '#d9d9d9',
        theme_a_blue:'#174f82'
    },

    color_ball :[
         '#FFFF00', //0  yellow
         '#FF0000',  //1  red
         '#0000FF',  //2  blue
         '#00FF00', //3  gren
         '#00FFFF', //4  light blue
         '#000000', //5  black
         '#bf80ff', //6 violet

         '#FF00FF', //7  light red
         '#909090', //8 grey
         '#99FF99' //9  light green -- kiepsko widoczny kolor!!!!
    ],
    settings : {
        sizeLoader : 1,
        //ticPadding : 4,
        ticPadding : 10,
        ticPaddingMark : 5,
        ticPaddingX : 14,
        ticWidth : 6,
        ticWidthX : 4
    },
    action :{
        rows : 9,
        cols : 9,
        len : 5,
        blank : -1,
        balls_color_no : 6, //dotyczy kolorow, 8-trudno wygrac
        balls_next_no : 3,
        balls_next_no_variety: 0,
        balls_init_no : 5,
        score : 0
    }

};

var counter = 0;

if (Modernizr.canvas ){

    window.addEventListener("load", function() {
        if(typeof  lang !==  'undefined' ){
            conf.lang =  lang;
        }

        if(typeof  balllinesV2 !==  'undefined' ){
            conf.ver = '2';
            conf.action.rows = 8;
            conf.action.cols = 8;
            conf.action.len = 4;
            conf.action.balls_next_no = 4;
            conf.action.balls_next_no_variety = 10;
            conf.action.balls_color_no = 7;
            conf.text.pl.title = 'Kulki v2';
            conf.text.en.title = 'Ball lines v2';
            var jewelProto = document.getElementById(  'square-size-checkers' );
            var rect = jewelProto.getBoundingClientRect();
            conf.settings.ticSize = rect.width;

            var balllines_score =  JSON.parse(localStorage.getItem('balllines_score2' ));
        }else if(typeof  balllinesV3 !==  'undefined' ){
            conf.ver = '3';
            conf.action.rows = 10;
            conf.action.cols = 10;
            conf.action.len = 6;
            conf.action.balls_color_no = 7;
	          conf.action.balls_next_no = 2;
            conf.action.balls_next_no_variety = 10;
            conf.text.pl.title = 'Kulki v3';
            conf.text.en.title = 'Ball lines v3';
            var jewelProto = document.getElementById(   'square-size-ten'  );
            var rect = jewelProto.getBoundingClientRect();
            conf.settings.ticSize = rect.width;

            var balllines_score =  JSON.parse(localStorage.getItem('balllines_score3' ));
        }else{
            conf.ver = '1';
            var jewelProto = document.getElementById(  'square-size'  );
            var rect = jewelProto.getBoundingClientRect();
            conf.settings.ticSize = rect.width;

            var balllines_score =  JSON.parse(localStorage.getItem('balllines_score1' ));
        }

        if(balllines_score){
          conf.action.score = balllines_score;
          //localStorage.removeItem('balllines_score');
        }else{
          conf.action.score = 0;
        }

        display.initialize( conf );

    }, false);

}else{
    alert(  conf.text['pl'].alternative +  " / " +    conf.text['en'].alternative );
}
<|endoftext|>


<commit_before>
$.extend($.easing,
{
    def: 'easeOutQuad',
    easeInOutExpo: function (x, t, b, c, d) {
        if (t==0) return b;
        if (t==d) return b+c;
        if ((t/=d/2) < 1) return c/2 * Math.pow(2, 10 * (t - 1)) + b;
        return c/2 * (-Math.pow(2, -10 * --t) + 2) + b;
    }
});

(function( $ ) {

    var settings;
    var disableScrollFn = false;
    var navItems;
    var navs = {}, sections = {};

    $.fn.navScroller = function(options) {
        settings = $.extend({
            scrollToOffset: 170,
            scrollSpeed: 800,
            activateParentNode: true,
        }, options );
        navItems = this;

        //attatch click listeners
    	navItems.on('click', function(event){
    		event.preventDefault();
            var navID = $(this).attr("href").substring(1);
            disableScrollFn = true;
            activateNav(navID);
            populateDestinations(); //recalculate these!
        	$('html,body').animate({scrollTop: sections[navID] - settings.scrollToOffset},
                settings.scrollSpeed, "easeInOutExpo", function(){
                    disableScrollFn = false;
                }
            );
    	});

        //populate lookup of clicable elements and destination sections
        populateDestinations(); //should also be run on browser resize, btw

        // setup scroll listener
        $(document).scroll(function(){
            if (disableScrollFn) { return; }
            var page_height = $(window).height();
            var pos = $(this).scrollTop();
            for (i in sections) {
                if ((pos + settings.scrollToOffset >= sections[i]) && sections[i] < pos + page_height){
                    activateNav(i);
                }
            }
        });
    };

    function populateDestinations() {
        navItems.each(function(){
            var scrollID = $(this).attr('href').substring(1);
            navs[scrollID] = (settings.activateParentNode)? this.parentNode : this;
            sections[scrollID] = $(document.getElementById(scrollID)).offset().top;
        });
    }

    function activateNav(navID) {
        for (nav in navs) { $(navs[nav]).removeClass('active'); }
        $(navs[navID]).addClass('active');
    }
})( jQuery );

$(document).ready(function (){

    $('nav li a').navScroller();

    //section divider icon click gently scrolls to reveal the section
	$(".sectiondivider").on('click', function(event) {
    	$('html,body').animate({scrollTop: $(event.target.parentNode).offset().top - 50}, 400, "linear");
	});

    //links going to other sections nicely scroll
	$(".container a").each(function(){
        if ($(this).attr("href").charAt(0) == '#'){
            $(this).on('click', function(event) {
        		event.preventDefault();
                var target = $(event.target).closest("a");
                var targetHight =  $(target.attr("href")).offset().top
            	$('html,body').animate({scrollTop: targetHight - 170}, 800, "easeInOutExpo");
            });
        }
	});

	$('#usmap').width($('html').width() * .5);
	$('#usmap').height($('#usmap').width() * .68);
	$('#usmap').usmap({
		'stateStyles': { fill: '#5AAC00', 'stroke': 'black', 'stroke-width': 2 },
		'stateHoverStyles': { fill: '#7BEC00' },

		'mouseoverState': {
			'HI': function (event, data) {
				//return false;
			}
		},

		'click': function (event, data) {
			$('#alert')
			  .text('Click ' + data.name + ' on map 1')
			  .stop()
			  .css('backgroundColor', '#ff0')
			  .animate({ backgroundColor: '#ddd' }, 1000);
		}
	});

	$('html').resize(function() {
		$('#usmap').width($('html').width() * .5);
		$('#usmap').height($('#usmap').width() * .68);
		$('#usmap').usmap({
			'stateStyles': { fill: '#5AAC00', 'stroke': 'black', 'stroke-width': 2 },
			'stateHoverStyles': { fill: '#7BEC00' },

			'mouseoverState': {
				'HI': function (event, data) {
					//return false;
				}
			},

			'click': function (event, data) {
				$('#alert')
				  .text('Click ' + data.name + ' on map 1')
				  .stop()
				  .css('backgroundColor', '#ff0')
				  .animate({ backgroundColor: '#ddd' }, 1000);
			}
		});
	});
});

<commit_msg>map adjustments<commit_after>
$.extend($.easing,
{
    def: 'easeOutQuad',
    easeInOutExpo: function (x, t, b, c, d) {
        if (t==0) return b;
        if (t==d) return b+c;
        if ((t/=d/2) < 1) return c/2 * Math.pow(2, 10 * (t - 1)) + b;
        return c/2 * (-Math.pow(2, -10 * --t) + 2) + b;
    }
});

(function( $ ) {

    var settings;
    var disableScrollFn = false;
    var navItems;
    var navs = {}, sections = {};

    $.fn.navScroller = function(options) {
        settings = $.extend({
            scrollToOffset: 170,
            scrollSpeed: 800,
            activateParentNode: true,
        }, options );
        navItems = this;

        //attatch click listeners
    	navItems.on('click', function(event){
    		event.preventDefault();
            var navID = $(this).attr("href").substring(1);
            disableScrollFn = true;
            activateNav(navID);
            populateDestinations(); //recalculate these!
        	$('html,body').animate({scrollTop: sections[navID] - settings.scrollToOffset},
                settings.scrollSpeed, "easeInOutExpo", function(){
                    disableScrollFn = false;
                }
            );
    	});

        //populate lookup of clicable elements and destination sections
        populateDestinations(); //should also be run on browser resize, btw

        // setup scroll listener
        $(document).scroll(function(){
            if (disableScrollFn) { return; }
            var page_height = $(window).height();
            var pos = $(this).scrollTop();
            for (i in sections) {
                if ((pos + settings.scrollToOffset >= sections[i]) && sections[i] < pos + page_height){
                    activateNav(i);
                }
            }
        });
    };

    function populateDestinations() {
        navItems.each(function(){
            var scrollID = $(this).attr('href').substring(1);
            navs[scrollID] = (settings.activateParentNode)? this.parentNode : this;
            sections[scrollID] = $(document.getElementById(scrollID)).offset().top;
        });
    }

    function activateNav(navID) {
        for (nav in navs) { $(navs[nav]).removeClass('active'); }
        $(navs[navID]).addClass('active');
    }
})( jQuery );

$(document).ready(function (){

    $('nav li a').navScroller();

    //section divider icon click gently scrolls to reveal the section
	$(".sectiondivider").on('click', function(event) {
    	$('html,body').animate({scrollTop: $(event.target.parentNode).offset().top - 50}, 400, "linear");
	});

    //links going to other sections nicely scroll
	$(".container a").each(function(){
        if ($(this).attr("href").charAt(0) == '#'){
            $(this).on('click', function(event) {
        		event.preventDefault();
                var target = $(event.target).closest("a");
                var targetHight =  $(target.attr("href")).offset().top
            	$('html,body').animate({scrollTop: targetHight - 170}, 800, "easeInOutExpo");
            });
        }
	});

	$('#usmap').width($('html').width() * .5);
	$('#usmap').height($('#usmap').width() * .68);
	$('#usmap').usmap({
		'stateStyles': { fill: '#5AAC00', 'stroke': 'black', 'stroke-width': 2 },
		'stateHoverStyles': { fill: '#7BEC00' },

		'mouseoverState': {
			'HI': function (event, data) {
				//return false;
			}
		},

		'click': function (event, data) {
			$('#alert')
			  .text('Click ' + data.name + ' on map 1')
			  .stop()
			  .css('backgroundColor', '#ff0')
			  .animate({ backgroundColor: '#ddd' }, 1000);
		}
	});

	$(window).on('resize', function(){
		$('#usmap').width($('html').width() * .5);
		$('#usmap').height($('#usmap').width() * .68);
		$('#usmap').usmap({
			'stateStyles': { fill: '#5AAC00', 'stroke': 'black', 'stroke-width': 2 },
			'stateHoverStyles': { fill: '#7BEC00' },

			'mouseoverState': {
				'HI': function (event, data) {
					//return false;
				}
			},

			'click': function (event, data) {
				$('#alert')
				  .text('Click ' + data.name + ' on map 1')
				  .stop()
				  .css('backgroundColor', '#ff0')
				  .animate({ backgroundColor: '#ddd' }, 1000);
			}
		});
	});
});

<|endoftext|>


<commit_before>// __Dependencies__
var deco = require('deco');
var mongoose = require('mongoose');
var Api = require('./Api');
var Controller = require('./Controller');
var Model = require('./Model');
var BaucisError = require('baucis-error');
var plugins = {
  json: require('baucis-json')
};

var instance = Api();
var parsers = {};
var formatters = {};

// __Module Definition__
var baucis = module.exports = function (options) {
  return baucis.empty();
};

// __Public Members__
baucis.rest = function (model) {
  return instance.rest(model);
};

baucis.empty = function () {
  var previous = instance;
  instance = Api();
  return previous;
};

baucis.formatters = function (response, callback) {
  var handlers = {
    default: function () {
      callback(BaucisError.NotAcceptable());
    }
  };
  Object.keys(formatters).map(function (mime) {
    handlers[mime] = formatters[mime](callback);
  });
  response.format(handlers);
};

// Adds a formatter for the given mime type.  Needs a function that returns a stream.
baucis.setFormatter = function (mime, f) {
  formatters[mime] = function (callback) { return function () { callback(null, f) } };
  return baucis;
};

baucis.parser = function (mime) {
  // Default to JSON when no MIME type is provided.
  mime = mime || 'application/json';
  // Not interested in any additional parameters at this point.
  mime = mime.split(';')[0].trim();
  var handler = parsers[mime];
  return handler ? handler() : undefined;
};

// Adds a parser for the given mime type.  Needs a function that returns a stream.
baucis.setParser = function (mime, f) {
  parsers[mime] = f;
  return baucis;
};

// __Expose Modules__
baucis.Api = Api;
baucis.Controller = Controller;
baucis.Error = BaucisError;
baucis.Model = Model;

Api.container(baucis);
Controller.container(baucis);
BaucisError.container(baucis);
Model.container(baucis);

// __Plugins__
plugins.json.apply(baucis);
<commit_msg>Provide a callback that allows last minute hooks to the current controller<commit_after>// __Dependencies__
var express = require("express");
var deco = require('deco');
var mongoose = require('mongoose');
var Api = require('./Api');
var Controller = require('./Controller');
var Model = require('./Model');
var BaucisError = require('baucis-error');
var plugins = {
  json: require('baucis-json')
};

var instance = Api();
var parsers = {};
var formatters = {};

// __Module Definition__
var baucis = module.exports = function (cb) {
	var a = express.Router();

	//
	// Make last minute hooks to the current controller
	//
	if (cb) {
		cb(a);
	}

	a.use("/", baucis.empty());
	return a;
};

// __Public Members__
baucis.rest = function (model) {
  return instance.rest(model);
};

baucis.empty = function () {
  var previous = instance;
  instance = Api();
  return previous;
};

baucis.formatters = function (response, callback) {
  var handlers = {
    default: function () {
      callback(BaucisError.NotAcceptable());
    }
  };
  Object.keys(formatters).map(function (mime) {
    handlers[mime] = formatters[mime](callback);
  });
  response.format(handlers);
};

// Adds a formatter for the given mime type.  Needs a function that returns a stream.
baucis.setFormatter = function (mime, f) {
  formatters[mime] = function (callback) { return function () { callback(null, f) } };
  return baucis;
};

baucis.parser = function (mime) {
  // Default to JSON when no MIME type is provided.
  mime = mime || 'application/json';
  // Not interested in any additional parameters at this point.
  mime = mime.split(';')[0].trim();
  var handler = parsers[mime];
  return handler ? handler() : undefined;
};

// Adds a parser for the given mime type.  Needs a function that returns a stream.
baucis.setParser = function (mime, f) {
  parsers[mime] = f;
  return baucis;
};

baucis.controllers = function() {
	return instance.controllers();
};

// __Expose Modules__
baucis.Api = Api;
baucis.Controller = Controller;
baucis.Error = BaucisError;
baucis.Model = Model;

Api.container(baucis);
Controller.container(baucis);
BaucisError.container(baucis);
Model.container(baucis);

// __Plugins__
plugins.json.apply(baucis);
<|endoftext|>


<commit_before>$.getScript("https://rawgit.com/MuseDJ/MusiqpadScript/master/scripts/main.js");
var startTime = Date.now();
var museLoader = setInterval(function() {
    if (typeof API !== "undefined")
        if (typeof muse !== "undefined"){
			clearInterval(museLoader);
            muse.fn.init();
            muse.fn.logger.info("Initialized in " + Date.now() - startTime);
		}
}, 250);
<commit_msg>Finalized loader<commit_after>var startTime = Date.now();
if (typeof muse !== "undefined") {
    muse.fn.end();
}

$.getScript("https://rawgit.com/MuseDJ/MusiqpadScript/master/scripts/main.js");

museLoader = function() {
    if (typeof API !== "undefined" && typeof muse !== "undefined") {
        muse.fn.init();
        muse.fn.logger.info("Initialized in " + API.util.timeConvert(Date.now()).milisseconds, startTime);
		delete museLoader;
    } else {
        setTimeout(museLoader, 250);
    }
};

museLoader();
<|endoftext|>


<commit_before>var docpadConfig,
  indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; };

var imgBaseUrl = '/images/';
var sponsorsImgBaseUrl = imgBaseUrl + 'sponsors/';
var speakersImgBaseUrl = imgBaseUrl + 'speakers/';
var partnersImgBaseUrl = imgBaseUrl + 'partners/';

docpadConfig = {
  outPath: '../2015.mobilization.pl-gh-pages/',
  templateData: {
    site: {
      url: "http://mobilization.pl",
      oldUrls: ['www.mobilization.pl'],
      title: "Mobilization 2015",
      description: "Mobilization is a conference dedicated to mobile technologies. The main scope is development of mobile solutions aimed at smartphones and tablets, with particular interest in Android, iOS and Windows Phone platforms.",
      keywords: "mobilization, conference, mobile conference, Łódź",
      styles: [],
      scripts: [],

      event: {
      	title: 'Mobilization 2015',
      	location: {
      		lat: 51.7505458,
      		lng: 19.4501351,
      		place: 'Expo-Łódź Sp. z o.o.',
      		street: 'al. Politechniki 4',
      		city: 'Łódź',
      		zip: '93-590',
      		country: 'Polska'
      	},
      	data: '17th Oct 2015',
      	time: '07:30-17:30'
      },
      sponsors: {
      	platinum: [
			{"name":"Seamless","logo_url":"/images/sponsors/seamless.png","link":"http://seamless.se/"},
			{"name":"TomTom","logo_url":"/images/sponsors/tomtom.png","link":"http://www.tomtom.com/pl_pl/"}
      	],
      	gold: [
			{"name":"Ericpol","logo_url":"/images/sponsors/ericpol.jpg","link":"http://www.ericpol.pl/"}
      	],
      	silver: [

      	],
      },
      partners: {
      	organizers: [
      		{
      			name: 'Java User Group Łódź',
      			logo_url: partnersImgBaseUrl + 'juglodz.png',
      			description_html: 'Łódź JUG is an association of Java developers, architects and enthusiasts of Java technology from Łódź, the city in the centre of Poland. The aim of the association is to promote exchange of knowledge and competence growth among Java professionals in the Łódźarea. The main activity towards this goal is organisation of IT-related seminars and meetings that usually involve a presentation about chosen topic and then follow-up discussion. LJUG cooperates with other JUGs in Poland, like Polish JUG and Warsaw JUG. We encourage everyone interested in Java technologies to join and start participating in our expertise-sharing activities! Java User Group Łódź is main organizer of Mobilization event since 2011'
      		}
      	],
      	supporters: [
			{"name":"Upmenu","logo_url":"/images/partners/upmenu.png","description_html":"Upmenu had created new layout for Mobilization 2014! which is used for Mobilization 2015. Besides creating mobile and responsive layouts they work in Horeca business and help restaurants with online orders. Check out more on their webpage"},
      	],
      	community: [
			{"name":"Łódź WiOSłuje","logo_url":"/images/partners/lodz-wiosluje.png","description_html":"The best place for iOS developers based in Łódź. A group with monthly meetings with tech talks, fantastic speakers and unbeatable atmosphere! Join us on facebook: www.facebook.com/lodzwiosluje"},
			 {"name":"Toruń JUG","logo_url":"/images/partners/jugtorun5d_3_square.png","description_html":"Toruń JUG is a group of JVM technologies developers and enthusiasts. The main goal of the group is to gather people interested in JVM languages both professionally and personally. Our group contains programmers from many companies, scientists working on Toruń university, students and other technology passionates. We are encouraging knowledge sharing and collaboration in open source projects. Although we are the youngest JUG in Poland we are growing fast already having several big partners supporting us. More about Toruń JUG you can find at: torun.jug.pl"},
			 {"name":"Polish Java User Group","logo_url":"/images/partners/polish-jug.png","description_html":"Polish Java User Group is a group of Java technology developers and enthusiasts. The main goal of the group is to popularize Java and modern software development methodologies. Since the beginning in 1999, the group had great impact on the Polish Java community growth. They main activity are meetings with students, programmers and project managers as well as conferences with famous professionals."},
			// {"name":"Mobile Central Europe 2015","logo_url":"/images/partners/mce2015.png","description_html":"We put our best effort into creating a stimulating experience for everyone involved. Help us make it one of the best mobile events in Europe! MCE is about bringing together the greatest minds in tech to exchange groundbreaking ideas. For Mobilization attendees promo-code will be offered giving 20% discount. Code will be visible during Mobilization event so you have to be on Mobilization! With this discount and early bird the ticket for MCE is really good price."},
			{"name":"GDG Kraków","logo_url":"/images/partners/gdgkrakow.png","link":"http://www.meetup.com/GDG-Krakow/"},
			// {"name":"MIT Łódź","logo_url":"/images/partners/mit.png","link":"http://mitlodz.pl"},
			{"name":"Dev Day 2015","logo_url":"/images/partners/abb-dev-day.svg","link":"http://devday.pl"},
			{"name":"Codepot.pl","logo_url":"/images/partners/codepot-logo.svg","link":"http://codepot.pl"},
      	],
      	media: [
			// {"name":"AK74","logo_url":"/images/partners/ak74.png","description_html":"Cześć! Nazywam się Artur Kurasiński i jestem autorem tego bloga. Na co dzień zajmuję się Fokusem. Jestem współtwórcą cyklu spotkań dla przedsiębiorców Aula Polska oraz konkursu Aulery. Jako vloger prowadzę program „Seria z AK74″. Czasami udzielam się jako mentor na imprezach z cyklu Seedcamp, Labstar, DemoCamp, Intel Challenge, i StartupFest. Więcej znajdziesz tutaj: LinkedIn.com czy Facebooku lub Twitterze Chcesz się ze mną skontaktować?: Wyślij maila na adres: artur@revolver.pl"},
			// {"name":"Marketing Mobilny","logo_url":"/images/partners/marketing-mobilny.jpg","link":"http://marketingmobilny.pl"},
			// {"name":"Dworzynska","logo_url":"/images/partners/dworzynska.png","link":"http://dworzynska.com"},
			// {"name":"Praca IT","logo_url":"/images/partners/pracait.png","link":"http://pracait.com"},
			// {"name":"Software Developer's Journal","logo_url":"/images/partners/sdj.png","link":"http://sdjournal.pl"},
			{"name":"GoMobi","logo_url":"/images/partners/gomobi.jpg","link":"http://gomobi.pl"},
			// {"name":"Programista Magazine","logo_url":"/images/partners/programistamag.png","link":"http://programistamag.pl"},
			// {"name":"MyApple","logo_url":"/images/partners/myapple.jpg","link":"http://myapple.pl"},
			// {"name":"4tech.tv","logo_url":"/images/partners/4techmobile.png","link":"http://testytelefonow.pl"},
			// {"name":"StartUpTV","logo_url":"/images/partners/startuptv.png","link":"http://startuptv.pl"},
//			{"name":"Linux Magazine","logo_url":"/images/partners/linuxmag.png","link":"http://www.linux-magazine.pl"},
			// {"name":"Kariera Plus","logo_url":"/images/partners/karieraplus.png","link":"http://karieraplus.pl"},
			// {"name":"Młodzi w Łodzi","logo_url":"/images/partners/mlodzi-w-lodzi.jpg","link":"http://mlodziwlodzi.pl"},
			{"name":"Helion","logo_url":"/images/partners/helionpl.png","link":"http://helion.pl"},
			// {"name":"Manning Publications","logo_url":"/images/partners/manning.png","link":"http://www.manning.com"}
      	]
      },
      slots: {
      	'slot-registration': {
      		from: '7:30',
      		to:   '9:00'
      	},
      	'slot-hello-world': {
      		from: '9:00',
      		to:   '9:10'
      	},
      	'slot-1': {
      		from: '9:10',
      		to:   '9:55'
      	},
      	'slot-coffee-1': {
      	   	from: '9:55',
      		to:   '10:15'
      	},
      	'slot-2': {
      		from: '10:15',
      		to:   '11:00'
      	},
      	'slot-coffee-2': {
      	   	from: '11:00',
      		to:   '11:20'
      	},
      	'slot-3': {
      		from: '11:20',
      		to:   '12:05'
      	},
      	'slot-coffee-3': {
      	   	from: '12:05',
      		to:   '12:25'
      	},
       	'slot-4': {
      		from: '12:25',
      		to:   '13:10'
      	},
      	'slot-lunch': {
      	   	from: '13:10',
      		to:   '14:30'
      	},
        'slot-5': {
      		from: '14:30',
      		to:   '15:15'
      	},
        'slot-coffee-4': {
      	   	from: '15:15',
      		to:   '15:30'
      	},
        'slot-6': {
      		from: '15:30',
      		to:   '16:15'
      	},
        'slot-coffee-5': {
      	   	from: '16:15',
      		to:   '16:30'
      	},
        'slot-7': {
      		from: '16:30',
      		to:   '17:15'
      	},
      	'slot-finally': {
      		from: '17:15',
      		to:   '18:00'
      	},
      },
      speakers: {

   	  },
   	  talks: {

   	  },
   	  breaks: {
   	  	'break-registration': {
   	  		title: 'Registration',
   	  		description_html: 'If you do not want to miss any presentation please register between 7:30-9:10. However, registration will be opened all day!'
   	  	},
   	  	'break-hello-world': {
   	  		title: 'Hello World',
   	  		description_html: 'This is couple of words about Mobilization. For community by community.'
   	  	},
   	  	'break-coffee': {
   	  	 	title: 'Coffee Break',
   	  		description_html: ''
   	  	},
   	  	'break-lunch': {
   	  		title: 'Lunch Break',
   	  		description_html: 'There is Solider soup - "Grochówka" for everyone! VIPs (Speakers, Sponsors) have lunch in Congresowa Restaurant on base floor.'
   	  	},
   	  	'break-finally': {
   	  		title: 'Finally',
   	  		description_html: ''
   	  	}
   	  },
   	  venues: {

   	  },
   	  schedule: {

   	  }
    },
    getPreparedTitle: function() {
      if (this.document.title) {
        return this.document.title + " | " + this.site.title;
      } else {
        return this.site.title;
      }
    },
    getPreparedDescription: function() {
      return this.document.description || this.site.description;
    },
    getPreparedKeywords: function() {
      return this.site.keywords.concat(this.document.keywords || []).join(', ');
    }
  },
  collections: {
    posts: function() {
      return this.getCollection('documents').findAllLive({
        relativeOutDirPath: 'posts'
      });
    }
  },
  environments: {
    development: {
      templateData: {
        site: {
          url: false
        }
      }
    }
  },
  events: {
    serverExtend: function(opts) {
      var docpad, latestConfig, newUrl, oldUrls, server;
      server = opts.server;
      docpad = this.docpad;
      latestConfig = docpad.getConfig();
      oldUrls = latestConfig.templateData.site.oldUrls || [];
      newUrl = latestConfig.templateData.site.url;
      return server.use(function(req, res, next) {
        var ref;
        if (ref = req.headers.host, indexOf.call(oldUrls, ref) >= 0) {
          return res.redirect(newUrl + req.url, 301);
        } else {
          return next();
        }
      });
    }
  }
};

module.exports = docpadConfig;

// ---
// generated by coffee-script 1.9.2
<commit_msg>[PARTNERS] add mising partners<commit_after>var docpadConfig,
  indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; };

var imgBaseUrl = '/images/';
var sponsorsImgBaseUrl = imgBaseUrl + 'sponsors/';
var speakersImgBaseUrl = imgBaseUrl + 'speakers/';
var partnersImgBaseUrl = imgBaseUrl + 'partners/';

docpadConfig = {
  outPath: '../2015.mobilization.pl-gh-pages/',
  templateData: {
    site: {
      url: "http://mobilization.pl",
      oldUrls: ['www.mobilization.pl'],
      title: "Mobilization 2015",
      description: "Mobilization is a conference dedicated to mobile technologies. The main scope is development of mobile solutions aimed at smartphones and tablets, with particular interest in Android, iOS and Windows Phone platforms.",
      keywords: "mobilization, conference, mobile conference, Łódź",
      styles: [],
      scripts: [],

      event: {
      	title: 'Mobilization 2015',
      	location: {
      		lat: 51.7505458,
      		lng: 19.4501351,
      		place: 'Expo-Łódź Sp. z o.o.',
      		street: 'al. Politechniki 4',
      		city: 'Łódź',
      		zip: '93-590',
      		country: 'Polska'
      	},
      	data: '17th Oct 2015',
      	time: '07:30-17:30'
      },
      sponsors: {
      	platinum: [
			{"name":"Seamless","logo_url":"/images/sponsors/seamless.png","link":"http://seamless.se/"},
			{"name":"TomTom","logo_url":"/images/sponsors/tomtom.png","link":"http://www.tomtom.com/pl_pl/"}
      	],
      	gold: [
			{"name":"Ericpol","logo_url":"/images/sponsors/ericpol.jpg","link":"http://www.ericpol.pl/"}
      	],
      	silver: [

      	],
      },
      partners: {
      	organizers: [
      		{
      			name: 'Java User Group Łódź',
      			logo_url: partnersImgBaseUrl + 'juglodz.png',
      			description_html: 'Łódź JUG is an association of Java developers, architects and enthusiasts of Java technology from Łódź, the city in the centre of Poland. The aim of the association is to promote exchange of knowledge and competence growth among Java professionals in the Łódźarea. The main activity towards this goal is organisation of IT-related seminars and meetings that usually involve a presentation about chosen topic and then follow-up discussion. LJUG cooperates with other JUGs in Poland, like Polish JUG and Warsaw JUG. We encourage everyone interested in Java technologies to join and start participating in our expertise-sharing activities! Java User Group Łódź is main organizer of Mobilization event since 2011'
      		}
      	],
      	supporters: [
			{"name":"Upmenu","logo_url":"/images/partners/upmenu.png","description_html":"Upmenu had created new layout for Mobilization 2014! which is used for Mobilization 2015. Besides creating mobile and responsive layouts they work in Horeca business and help restaurants with online orders. Check out more on their webpage"},
      	],
      	community: [
			{"name":"Łódź WiOSłuje","logo_url":"/images/partners/lodz-wiosluje.png","description_html":"The best place for iOS developers based in Łódź. A group with monthly meetings with tech talks, fantastic speakers and unbeatable atmosphere! Join us on facebook: www.facebook.com/lodzwiosluje"},
			 {"name":"Toruń JUG","logo_url":"/images/partners/jugtorun5d_3_square.png","description_html":"Toruń JUG is a group of JVM technologies developers and enthusiasts. The main goal of the group is to gather people interested in JVM languages both professionally and personally. Our group contains programmers from many companies, scientists working on Toruń university, students and other technology passionates. We are encouraging knowledge sharing and collaboration in open source projects. Although we are the youngest JUG in Poland we are growing fast already having several big partners supporting us. More about Toruń JUG you can find at: torun.jug.pl"},
			 {"name":"Polish Java User Group","logo_url":"/images/partners/polish-jug.png","description_html":"Polish Java User Group is a group of Java technology developers and enthusiasts. The main goal of the group is to popularize Java and modern software development methodologies. Since the beginning in 1999, the group had great impact on the Polish Java community growth. They main activity are meetings with students, programmers and project managers as well as conferences with famous professionals."},
			// {"name":"Mobile Central Europe 2015","logo_url":"/images/partners/mce2015.png","description_html":"We put our best effort into creating a stimulating experience for everyone involved. Help us make it one of the best mobile events in Europe! MCE is about bringing together the greatest minds in tech to exchange groundbreaking ideas. For Mobilization attendees promo-code will be offered giving 20% discount. Code will be visible during Mobilization event so you have to be on Mobilization! With this discount and early bird the ticket for MCE is really good price."},
			{"name":"GDG Kraków","logo_url":"/images/partners/gdgkrakow.png","link":"http://www.meetup.com/GDG-Krakow/"},
			// {"name":"MIT Łódź","logo_url":"/images/partners/mit.png","link":"http://mitlodz.pl"},
			{"name":"Dev Day 2015","logo_url":"/images/partners/abb-dev-day.svg","link":"http://devday.pl"},
			{"name":"Codepot.pl","logo_url":"/images/partners/codepot-logo.svg","link":"http://codepot.pl"},
      	],
      	media: [
         	{"name":"MyApple","logo_url":"/images/partners/myapple.jpg","link":"http://myapple.pl"},
            {"name":"GoMobi","logo_url":"/images/partners/gomobi.jpg","link":"http://gomobi.pl"},
			// {"name":"AK74","logo_url":"/images/partners/ak74.png","description_html":"Cześć! Nazywam się Artur Kurasiński i jestem autorem tego bloga. Na co dzień zajmuję się Fokusem. Jestem współtwórcą cyklu spotkań dla przedsiębiorców Aula Polska oraz konkursu Aulery. Jako vloger prowadzę program „Seria z AK74″. Czasami udzielam się jako mentor na imprezach z cyklu Seedcamp, Labstar, DemoCamp, Intel Challenge, i StartupFest. Więcej znajdziesz tutaj: LinkedIn.com czy Facebooku lub Twitterze Chcesz się ze mną skontaktować?: Wyślij maila na adres: artur@revolver.pl"},
			// {"name":"Marketing Mobilny","logo_url":"/images/partners/marketing-mobilny.jpg","link":"http://marketingmobilny.pl"},
			// {"name":"Dworzynska","logo_url":"/images/partners/dworzynska.png","link":"http://dworzynska.com"},
			// {"name":"Praca IT","logo_url":"/images/partners/pracait.png","link":"http://pracait.com"},
			// {"name":"Software Developer's Journal","logo_url":"/images/partners/sdj.png","link":"http://sdjournal.pl"},
			{"name":"GoMobi","logo_url":"/images/partners/gomobi.jpg","link":"http://gomobi.pl"},
			// {"name":"Programista Magazine","logo_url":"/images/partners/programistamag.png","link":"http://programistamag.pl"},
			 {"name":"MyApple","logo_url":"/images/partners/myapple.jpg","link":"http://myapple.pl"},
			// {"name":"4tech.tv","logo_url":"/images/partners/4techmobile.png","link":"http://testytelefonow.pl"},
			// {"name":"StartUpTV","logo_url":"/images/partners/startuptv.png","link":"http://startuptv.pl"},
//			{"name":"Linux Magazine","logo_url":"/images/partners/linuxmag.png","link":"http://www.linux-magazine.pl"},
			// {"name":"Kariera Plus","logo_url":"/images/partners/karieraplus.png","link":"http://karieraplus.pl"},
			// {"name":"Młodzi w Łodzi","logo_url":"/images/partners/mlodzi-w-lodzi.jpg","link":"http://mlodziwlodzi.pl"},
			{"name":"Helion","logo_url":"/images/partners/helionpl.png","link":"http://helion.pl"},
			// {"name":"Manning Publications","logo_url":"/images/partners/manning.png","link":"http://www.manning.com"}
      	]
      },
      slots: {
      	'slot-registration': {
      		from: '7:30',
      		to:   '9:00'
      	},
      	'slot-hello-world': {
      		from: '9:00',
      		to:   '9:10'
      	},
      	'slot-1': {
      		from: '9:10',
      		to:   '9:55'
      	},
      	'slot-coffee-1': {
      	   	from: '9:55',
      		to:   '10:15'
      	},
      	'slot-2': {
      		from: '10:15',
      		to:   '11:00'
      	},
      	'slot-coffee-2': {
      	   	from: '11:00',
      		to:   '11:20'
      	},
      	'slot-3': {
      		from: '11:20',
      		to:   '12:05'
      	},
      	'slot-coffee-3': {
      	   	from: '12:05',
      		to:   '12:25'
      	},
       	'slot-4': {
      		from: '12:25',
      		to:   '13:10'
      	},
      	'slot-lunch': {
      	   	from: '13:10',
      		to:   '14:30'
      	},
        'slot-5': {
      		from: '14:30',
      		to:   '15:15'
      	},
        'slot-coffee-4': {
      	   	from: '15:15',
      		to:   '15:30'
      	},
        'slot-6': {
      		from: '15:30',
      		to:   '16:15'
      	},
        'slot-coffee-5': {
      	   	from: '16:15',
      		to:   '16:30'
      	},
        'slot-7': {
      		from: '16:30',
      		to:   '17:15'
      	},
      	'slot-finally': {
      		from: '17:15',
      		to:   '18:00'
      	},
      },
      speakers: {

   	  },
   	  talks: {

   	  },
   	  breaks: {
   	  	'break-registration': {
   	  		title: 'Registration',
   	  		description_html: 'If you do not want to miss any presentation please register between 7:30-9:10. However, registration will be opened all day!'
   	  	},
   	  	'break-hello-world': {
   	  		title: 'Hello World',
   	  		description_html: 'This is couple of words about Mobilization. For community by community.'
   	  	},
   	  	'break-coffee': {
   	  	 	title: 'Coffee Break',
   	  		description_html: ''
   	  	},
   	  	'break-lunch': {
   	  		title: 'Lunch Break',
   	  		description_html: 'There is Solider soup - "Grochówka" for everyone! VIPs (Speakers, Sponsors) have lunch in Congresowa Restaurant on base floor.'
   	  	},
   	  	'break-finally': {
   	  		title: 'Finally',
   	  		description_html: ''
   	  	}
   	  },
   	  venues: {

   	  },
   	  schedule: {

   	  }
    },
    getPreparedTitle: function() {
      if (this.document.title) {
        return this.document.title + " | " + this.site.title;
      } else {
        return this.site.title;
      }
    },
    getPreparedDescription: function() {
      return this.document.description || this.site.description;
    },
    getPreparedKeywords: function() {
      return this.site.keywords.concat(this.document.keywords || []).join(', ');
    }
  },
  collections: {
    posts: function() {
      return this.getCollection('documents').findAllLive({
        relativeOutDirPath: 'posts'
      });
    }
  },
  environments: {
    development: {
      templateData: {
        site: {
          url: false
        }
      }
    }
  },
  events: {
    serverExtend: function(opts) {
      var docpad, latestConfig, newUrl, oldUrls, server;
      server = opts.server;
      docpad = this.docpad;
      latestConfig = docpad.getConfig();
      oldUrls = latestConfig.templateData.site.oldUrls || [];
      newUrl = latestConfig.templateData.site.url;
      return server.use(function(req, res, next) {
        var ref;
        if (ref = req.headers.host, indexOf.call(oldUrls, ref) >= 0) {
          return res.redirect(newUrl + req.url, 301);
        } else {
          return next();
        }
      });
    }
  }
};

module.exports = docpadConfig;

// ---
// generated by coffee-script 1.9.2
<|endoftext|>


<commit_before>Ext.ns('Ext.ux.form');

	Ext.ux.form.UploadField = Ext.extend(Ext.ux.form.FileUploadField, {
		/**
		 * Max surface area (example size 3000 x 2000)
		 */
		maxSurface: 6000000,

		/**
		 * @cfg uploadURL
		 */
		uploadURL: BASE + 'g/content/upload',

		/**
		 * @cfg supportedExtensions
		 */
		supportedExtensions: ['gif', 'jpg', 'jpeg', 'png'],

		/**
		 * Override, because MySQL null values != ''
		 */
		getValue: function(){
			var val = Ext.ux.form.UploadCombo.superclass.getValue.call(this);
			if (!val) {
				val = null;
			}
			return val;
		},

		/**
		 * Simple name based check
		 * @param {Object} fileName
		 */
		validateExtension: function(fileName){
			var extension = fileName.split('.');
			if (!extension) {
				return false;
			}
			extension = extension[extension.length - 1];
			var name = extension[0];
			if (!name.length) {
				return false; // also dont support files with an extension but no name
			}
			return this.supportedExtensions.indexOf(extension.toLowerCase()) > -1;
		},

		/**
		 * Validate resolution
		 */
		validateResolution: function(file, callback) {
			// What to do for browsers with no FileReader support, such as IE9?
			// For now, let's just admit defeat and allow the upload.
			if (typeof FileReader !== 'function') {
				callback(true);
				return;
			}
			var fr = new FileReader();
			var scope = this;
			fr.onload = function() {   // onload fires after reading is complete
				var img = new Image();
				img.onload = function() {
					var surface = img.width * img.height;
					var success = surface <= scope.maxSurface;
					callback(success);
				};
				img.src = fr.result;
			};
			fr.readAsDataURL(file);    // begin reading
		},

		/**
		 * Drop Handler
		 * @param {Object} e
		 */
		handleFileDrop: function(e){
			this.wrap.removeClass('x-focus');
			if (e.dataTransfer && e.dataTransfer.files && e.dataTransfer.files.length == 1) {
				this.performUpload(e.dataTransfer.files[0]);
			}
			return false;
		},

		/**
		 * Button Handler
		 */
		handleFileSelect: function(){
			this.performUpload(this.fileInput);
		},

		/**
		 * See if upload is image
		 */
		isImage: function(file) {
			var extension = file.name.split('.').pop();
			if (!extension) {
				return false;
			}

			var img_extensions = ['jpg', 'jpeg', 'png', 'gif'];
			for (var i = 0, ii = img_extensions.length; i < ii; ++i) {
				if (img_extensions[i] === extension) {
					alert('Plaatje ja!');
					return true;
				}
			}
			return false;
		},

		/**
		 * Check extension and go!
		 * @param {Object} fileInput field
		 */
		performUpload: function(fileInput){
			var scope = this;

			if (Ext.isIE) {

				var lm = new Ext.LoadMask(Ext.getBody(),{
					msg: __('Loading')
				});
				lm.show();
				var dh = Ext.DomHelper;
				var iframe = Ext.get(dh.insertHtml('beforeEnd', Ext.getBody().dom, ''));
				var form = Ext.get(dh.insertHtml('beforeEnd', Ext.getBody().dom, '<form method="post" target="uploadFrame" action="' + this.uploadURL + '" enctype="multipart/form-data"></form>'));
				Ext.get(fileInput).appendTo(form);
				iframe.on('load', function(){

					var result = Ext.decode(iframe.dom.contentDocument.body.innerHTML);
					if(!result || !result.success){
						//scope.setValue(scope.originalValue);
						Ext.Msg.alert(__('Garp'), __('Error uploading file.'));
					} else {
						scope.setValue(result.filename);
						scope.fireEvent('change', scope, result.filename);
					}

					form.remove();
					iframe.remove();
					lm.hide();

				});
				form.dom.submit();

			} else {
				var file;
				if (fileInput.dom && fileInput.dom.files) {
					file = fileInput.dom.files[0];
				} else {
					file = fileInput;//.dom.files[0];
				}
				if (!file || !file.name) {
					return;
				}

				var error = function(label, message) {
					scope.setValue(scope.originalValue);
					Ext.Msg.alert(label || __('Garp'), message || __('Error uploading file.'));
				};

				var proceedToUpload = function(success) {
					if (!success) {
						var readableMaxSurface = Ext.util.Format.number(scope.maxSurface, "1000.000/i");
						var exampleA = Math.floor(Math.sqrt(scope.maxSurface));
						// round to nearest 1000
						exampleA = Math.round((exampleA + 500) / 1000) * 1000;
						var exampleB = Math.floor(scope.maxSurface / exampleA);
						error(__('Error'), '' + __('Resolution too high. ' +
								'Please make sure the image\'s surface area does not exceed ' + readableMaxSurface) +
								' pixels.
For instance: ' + exampleA + ' x ' + exampleB + ' pixels.');

					} else if (!scope.validateExtension(file.name)) {

						error(__('Error'),
							'' + __('Extension not supported') + '

' +
							__('Supported extensions are:') + '
 ' + scope.supportedExtensions.join(' ')
						);

					} else {
						var fd = new FormData();
						var xhr = new XMLHttpRequest();
						scope.uploadDialog = Ext.Msg.progress(__('Upload'), __('Initializing upload'));

						fd.append('filename', file);

						xhr.addEventListener('load', function(e){
							var response = Ext.decode(xhr.responseText);
							scope.uploadDialog.hide();
							if (response.success) {
								scope.setValue(response.filename);
								scope.fireEvent('change', scope, response.filename);
							} else {
								error();
							}
						}, false);
						xhr.addEventListener('error', function(e){
							scope.uploadDialog.hide();
							error();
						}, false);
						xhr.upload.addEventListener('progress', function(e){
							if (e.lengthComputable) {
								scope.uploadDialog.updateProgress(e.loaded / e.total);
								scope.uploadDialog.updateText(__('Uploading') + ' ' + (Math.ceil(e.loaded / e.total * 100)) + '%');
							}
						}, false);

						xhr.open('POST', scope.uploadURL);
						scope.uploadDialog.updateText(__('Uploading…'));

						// we'll use a timeout to be sure that the dialog is ready, small downloads otherwise result in an ugly flashy UX
						setTimeout(function(){
							xhr.send(fd);
						}, 350);

					}
				};

				if (this.isImage(file)) {
					this.validateResolution(file, proceedToUpload);
				} else {
					proceedToUpload(true);
				}
			}
		},

		/**
		 * sets up Drag 'n Drop
		 */
		setupDnD: function(){

			var opts = {
				normalized: false,
				preventDefault: true,
				stopPropagation: true
			};

			this.wrap.on('dragenter', function(e){
				// unfortunately, we can't grab file extension here, so we'll present it as allowed. On drop we'll check extensions
				this.wrap.addClass('x-focus');
			}, this, opts);

			this.wrap.on('dragexit', function(e){
				this.wrap.removeClass('x-focus');
			}, this, opts);

			this.wrap.on('dragover', function(e){
			}, this, opts);

			this.wrap.on('drop', function(e){
				this.handleFileDrop(e);
			}, this, opts);
		},

		onDestroy: function(){
			if (this.uploadDialog) {
				this.uploadDialog.hide();
			}
			Ext.ux.form.UploadField.superclass.onDestroy.call(this);
		},

		initComponent: function(){
			this.on('fileselected', this.handleFileSelect, this);
			Ext.ux.form.UploadField.superclass.initComponent.call(this, arguments);
			this.on('afterrender', this.setupDnD, this);
		}
	});

Ext.reg('uploadfield', Ext.ux.form.UploadField);
<commit_msg>--debug alert thingy<commit_after>Ext.ns('Ext.ux.form');

	Ext.ux.form.UploadField = Ext.extend(Ext.ux.form.FileUploadField, {
		/**
		 * Max surface area (example size 3000 x 2000)
		 */
		maxSurface: 6000000,

		/**
		 * @cfg uploadURL
		 */
		uploadURL: BASE + 'g/content/upload',

		/**
		 * @cfg supportedExtensions
		 */
		supportedExtensions: ['gif', 'jpg', 'jpeg', 'png'],

		/**
		 * Override, because MySQL null values != ''
		 */
		getValue: function(){
			var val = Ext.ux.form.UploadCombo.superclass.getValue.call(this);
			if (!val) {
				val = null;
			}
			return val;
		},

		/**
		 * Simple name based check
		 * @param {Object} fileName
		 */
		validateExtension: function(fileName){
			var extension = fileName.split('.');
			if (!extension) {
				return false;
			}
			extension = extension[extension.length - 1];
			var name = extension[0];
			if (!name.length) {
				return false; // also dont support files with an extension but no name
			}
			return this.supportedExtensions.indexOf(extension.toLowerCase()) > -1;
		},

		/**
		 * Validate resolution
		 */
		validateResolution: function(file, callback) {
			// What to do for browsers with no FileReader support, such as IE9?
			// For now, let's just admit defeat and allow the upload.
			if (typeof FileReader !== 'function') {
				callback(true);
				return;
			}
			var fr = new FileReader();
			var scope = this;
			fr.onload = function() {   // onload fires after reading is complete
				var img = new Image();
				img.onload = function() {
					var surface = img.width * img.height;
					var success = surface <= scope.maxSurface;
					callback(success);
				};
				img.src = fr.result;
			};
			fr.readAsDataURL(file);    // begin reading
		},

		/**
		 * Drop Handler
		 * @param {Object} e
		 */
		handleFileDrop: function(e){
			this.wrap.removeClass('x-focus');
			if (e.dataTransfer && e.dataTransfer.files && e.dataTransfer.files.length == 1) {
				this.performUpload(e.dataTransfer.files[0]);
			}
			return false;
		},

		/**
		 * Button Handler
		 */
		handleFileSelect: function(){
			this.performUpload(this.fileInput);
		},

		/**
		 * See if upload is image
		 */
		isImage: function(file) {
			var extension = file.name.split('.').pop();
			if (!extension) {
				return false;
			}

			var img_extensions = ['jpg', 'jpeg', 'png', 'gif'];
			for (var i = 0, ii = img_extensions.length; i < ii; ++i) {
				if (img_extensions[i] === extension) {
					//alert('Plaatje ja!');
					return true;
				}
			}
			return false;
		},

		/**
		 * Check extension and go!
		 * @param {Object} fileInput field
		 */
		performUpload: function(fileInput){
			var scope = this;

			if (Ext.isIE) {

				var lm = new Ext.LoadMask(Ext.getBody(),{
					msg: __('Loading')
				});
				lm.show();
				var dh = Ext.DomHelper;
				var iframe = Ext.get(dh.insertHtml('beforeEnd', Ext.getBody().dom, ''));
				var form = Ext.get(dh.insertHtml('beforeEnd', Ext.getBody().dom, '<form method="post" target="uploadFrame" action="' + this.uploadURL + '" enctype="multipart/form-data"></form>'));
				Ext.get(fileInput).appendTo(form);
				iframe.on('load', function(){

					var result = Ext.decode(iframe.dom.contentDocument.body.innerHTML);
					if(!result || !result.success){
						//scope.setValue(scope.originalValue);
						Ext.Msg.alert(__('Garp'), __('Error uploading file.'));
					} else {
						scope.setValue(result.filename);
						scope.fireEvent('change', scope, result.filename);
					}

					form.remove();
					iframe.remove();
					lm.hide();

				});
				form.dom.submit();

			} else {
				var file;
				if (fileInput.dom && fileInput.dom.files) {
					file = fileInput.dom.files[0];
				} else {
					file = fileInput;//.dom.files[0];
				}
				if (!file || !file.name) {
					return;
				}

				var error = function(label, message) {
					scope.setValue(scope.originalValue);
					Ext.Msg.alert(label || __('Garp'), message || __('Error uploading file.'));
				};

				var proceedToUpload = function(success) {
					if (!success) {
						var readableMaxSurface = Ext.util.Format.number(scope.maxSurface, "1000.000/i");
						var exampleA = Math.floor(Math.sqrt(scope.maxSurface));
						// round to nearest 1000
						exampleA = Math.round((exampleA + 500) / 1000) * 1000;
						var exampleB = Math.floor(scope.maxSurface / exampleA);
						error(__('Error'), '' + __('Resolution too high. ' +
								'Please make sure the image\'s surface area does not exceed ' + readableMaxSurface) +
								' pixels.
For instance: ' + exampleA + ' x ' + exampleB + ' pixels.');

					} else if (!scope.validateExtension(file.name)) {

						error(__('Error'),
							'' + __('Extension not supported') + '

' +
							__('Supported extensions are:') + '
 ' + scope.supportedExtensions.join(' ')
						);

					} else {
						var fd = new FormData();
						var xhr = new XMLHttpRequest();
						scope.uploadDialog = Ext.Msg.progress(__('Upload'), __('Initializing upload'));

						fd.append('filename', file);

						xhr.addEventListener('load', function(e){
							var response = Ext.decode(xhr.responseText);
							scope.uploadDialog.hide();
							if (response.success) {
								scope.setValue(response.filename);
								scope.fireEvent('change', scope, response.filename);
							} else {
								error();
							}
						}, false);
						xhr.addEventListener('error', function(e){
							scope.uploadDialog.hide();
							error();
						}, false);
						xhr.upload.addEventListener('progress', function(e){
							if (e.lengthComputable) {
								scope.uploadDialog.updateProgress(e.loaded / e.total);
								scope.uploadDialog.updateText(__('Uploading') + ' ' + (Math.ceil(e.loaded / e.total * 100)) + '%');
							}
						}, false);

						xhr.open('POST', scope.uploadURL);
						scope.uploadDialog.updateText(__('Uploading…'));

						// we'll use a timeout to be sure that the dialog is ready, small downloads otherwise result in an ugly flashy UX
						setTimeout(function(){
							xhr.send(fd);
						}, 350);

					}
				};

				if (this.isImage(file)) {
					this.validateResolution(file, proceedToUpload);
				} else {
					proceedToUpload(true);
				}
			}
		},

		/**
		 * sets up Drag 'n Drop
		 */
		setupDnD: function(){

			var opts = {
				normalized: false,
				preventDefault: true,
				stopPropagation: true
			};

			this.wrap.on('dragenter', function(e){
				// unfortunately, we can't grab file extension here, so we'll present it as allowed. On drop we'll check extensions
				this.wrap.addClass('x-focus');
			}, this, opts);

			this.wrap.on('dragexit', function(e){
				this.wrap.removeClass('x-focus');
			}, this, opts);

			this.wrap.on('dragover', function(e){
			}, this, opts);

			this.wrap.on('drop', function(e){
				this.handleFileDrop(e);
			}, this, opts);
		},

		onDestroy: function(){
			if (this.uploadDialog) {
				this.uploadDialog.hide();
			}
			Ext.ux.form.UploadField.superclass.onDestroy.call(this);
		},

		initComponent: function(){
			this.on('fileselected', this.handleFileSelect, this);
			Ext.ux.form.UploadField.superclass.initComponent.call(this, arguments);
			this.on('afterrender', this.setupDnD, this);
		}
	});

Ext.reg('uploadfield', Ext.ux.form.UploadField);
<|endoftext|>


<commit_before>(function(s){var w,f={},o=window,l=console,m=Math,z='postMessage',p=0,r='hasOwnProperty',y=[].slice,x='fail',v=Worker;try{s=o.URL.createObjectURL(new Blob(["var f={},p=postMessage,r='hasOwnProperty';onmessage=function(e){var d=e.data,i=d.i,t=d[r]('t')?d.t:0;switch(d.n){case'a':f[i]=setInterval(function(){p(i)},t);break;case'b':if(f[r](i)){clearInterval(f[i]);delete f[i]}break;case'c':f[i]=setTimeout(function(){p(i);if(f[r](i))delete f[i]},t);break;case'd':if(f[r](i)){clearTimeout(f[i]);delete f[i]}break}}"]))}catch(e){}if(typeof(v)!=='undefined'){try{w=new v(s);o.setInterval=function(c,t){var i=++p;f[i]={c:c,p:y.call(arguments,2)};w[z]({n:'a',i:i,t:t});return i};o.clearInterval=function(i){if(f[r](i))delete f[i],w[z]({n:'b',i:i})};o.setTimeout=function(c,t){var i=++p;f[i]={c:c,p:y.call(arguments,2)};w[z]({n:'c',i:i,t:t});return i};o.clearTimeout=function(i){if(f[r](i))delete f[i],w[z]({n:'d',i:i})};w.onmessage=function(e){var n=e.data,c;if(f[r](n))n=f[n],c=n.c;if(typeof(c)=='string')try{c=new Function(c)}catch(k){}if(typeof(c)=='function')c.apply(o,n.p)}}catch(e){l.log(x)}}else l.log(x)})('HackTimerWorker.min.js');<commit_msg>(issue 13) Silent version updated to commit e11f3ed.<commit_after>(function(s){var w,f={},o=window,l=console,m=Math,z='postMessage',p=0,r='hasOwnProperty',y=[].slice,x='fail',v=Worker,a=0x7FFFFFFF;function d(){while(f[r](p))p=a>p?p+1:0;return p}try{s=o.URL.createObjectURL(new Blob(["var f={},p=postMessage,r='hasOwnProperty';onmessage=function(e){var d=e.data,i=d.i,t=d[r]('t')?d.t:0;switch(d.n){case'a':f[i]=setInterval(function(){p(i)},t);break;case'b':if(f[r](i)){clearInterval(f[i]);delete f[i]}break;case'c':f[i]=setTimeout(function(){p(i);if(f[r](i))delete f[i]},t);break;case'd':if(f[r](i)){clearTimeout(f[i]);delete f[i]}break}}"]))}catch(e){}if(typeof(v)!=='undefined'){try{w=new v(s);o.setInterval=function(c,t){var i=d();f[i]={c:c,p:y.call(arguments,2)};w[z]({n:'a',i:i,t:t});return i};o.clearInterval=function(i){if(f[r](i))delete f[i],w[z]({n:'b',i:i})};o.setTimeout=function(c,t){var i=d();f[i]={c:c,p:y.call(arguments,2)};w[z]({n:'c',i:i,t:t});return i};o.clearTimeout=function(i){if(f[r](i))delete f[i],w[z]({n:'d',i:i})};w.onmessage=function(e){var n=e.data,c;if(f[r](n))n=f[n],c=n.c;if(typeof(c)=='string')try{c=new Function(c)}catch(k){}if(typeof(c)=='function')c.apply(o,n.p)}}catch(e){l.log(x)}}else l.log(x)})('HackTimerWorker.min.js');<|endoftext|>