<commit_before>'use strict'

import {Component}          from 'react'
import {Link}               from 'react-router'
import DocumentTitle        from 'react-document-title'
import {bindActionCreators} from 'redux'
import {connect}            from 'react-redux'

import {BlogActions}       from '../datastore/Blog'
import {StatsActions}      from '../datastore/Stats'
import Image               from '../components/Image'
import Header              from '../components/Header'
import TokenBanner         from '../components/TokenBanner'
import ContentSection      from '../components/ContentSection'
import VideosPresentation  from '../components/VideosPresentation'
import {featuredApps}      from '../config'

function mapStateToProps(state) {
  return {
    posts: state.blog.posts,
    stats: state.stats,
  }
}

function mapDispatchToProps(dispatch) {
  return bindActionCreators(
    Object.assign({}, BlogActions, StatsActions),
    dispatch
  )
}

class FundingPage extends Component {

  render() {
    return (
      <DocumentTitle title="Blockstack Signature Fund">

            <TokenBanner />

                <Image className="blockstack-signature-fund-logo-md m-t-55 m-b-45"
                  src="/images/logos/blockstack-signature-fund-logo-rev.svg"
                  retinaSupport={false} />

                  "Money is bringing everybody in, but the thing we are creating is larger than ourselves, larger than money."

                  — Naval Ravikant at Blockstack Summit 2017

                  <Link to="/whitepaper.pdf" target="_blank" className="btn btn-electric-blue btn-block">
                    Apply Here!
                  </Link>

                      The Signature Fund for Blockstack is a $25M fund aimed at growing an ecosystem of decentralized applications on Blockstack.

                      We partnered with thesis-driven VC’s thesis-driven VC's who're aligned with our vision of a decentralized internet like Lux Capital, Rising Tide, Compound, OpenOcean, and VersionOne to fund app developers and teams looking to build their apps on the new fully decentralized internet. App creators will benefit directly from the deep expertise and insight of these experienced investors.

                      Additionally, those who apply will be first to hear 'x-prize' style prizes/bounties for large initiatives like building a decentralized microblogging platform, funded by investors like Naval Ravikant (founder, AngelList), Albert Wenger (managing partner, USV), and more

                        “Less white paper hype, more working code.”

                        — Jeremy Welch, Casa App Founder at Blockstack Summit 2017

                        There’s a lot of excitement about building decentralized applications, but we know it is still early days. At Blockstack we’ve created the core infrastructure to enable developers to build these applications, but we realize that to increase an app’s chances of success, it will require access to capital and tools to bootstrap networks.

                         We think in the long term it’s not just about raising a round or a token, but more about forging an ecosystem that keeps your application thriving. Here are just a few of the methods opening up to applications being built on Blockstack:

VC-led Funding: Blockstack Apps will get access to and capital from some of the best minds in the space.

Token: Blockstack Apps will be able to offer tokens on top of the Blockstack ecosystem, just like ERC20 tokens on Ethereum.

Advanced Payments: Forward a percentage of your app’s subscription fees to specific names/addresses to incentivize app-building behavior.

                        These are just the first steps to building an app ecosystem for the decentralized internet, and we expect tools to evolve and capabilities to grow.

                      Why Apply?

                      These is an early step to building a sustainable, responsible ecosystem.
                      Just like building skyscraper, we are now pouring the concrete foundation.
                      There will be many more layers to come.

                      How to Apply

                      You can apply as an individual or team by filling out the application form below or at the top of the page:

                      <Link to="/whitepaper.pdf" target="_blank" className="btn btn-electric-blue btn-block">
                        Apply Here!
                      </Link>

                      Once you apply, we’ll provide you with some starter materials to get started building apps on Blockstack.

                      Members of the Blockstack team will reach out to you if there’s interest in working more closely to build a team (if needed) and a product using Blockstack. Projects will be selected for funding consideration and support.

                      What is Blockstack?

                      Blockstack is a new fully decentralized internet that comes with a full stack of open-source developer tools to build and bootstrap decentralized applications and protocol ecosystems.

                      In Partnership with:

                        <Link to="https://compound.vc/" target="_blank">
                          <Image className="col-img partnerLogo" src="/images/logos/partner-logo-compound.svg"
                            retinaSupport={false} />
                        </Link>

                        <Link to="http://versionone.vc/" target="_blank">
                          <Image className="col-img partnerLogo" src="/images/logos/partner-logo-versionone.png"
                            retinaSupport={false} />
                        </Link>

                        <Link to="http://rtf.vc/" target="_blank">
                          <Image className="col-img partnerLogo" src="/images/logos/partner-logo-risingtide.png"
                            retinaSupport={false} />
                        </Link>

                        <Link to="http://www.luxcapital.com/" target="_blank">
                          <Image className="col-img partnerLogo-lux" src="/images/logos/partner-logo-lux.png"
                            retinaSupport={false} />
                        </Link>

                        <Link to="http://openocean.vc/" target="_blank">
                          <Image className="col-img partnerLogo" src="/images/logos/partner-logo-openocean.png"
                            retinaSupport={false} />
                        </Link>

                      Terms & Conditions

                      Thank you for your interest in Signature Fund. By submitting any information or materials to Blockstack regarding the Signature Fund program and application process (the "Program"), you (and the entity or business you represent) (collectively, "you") agree to be bound by the following terms:

                          You acknowledge and agree that Blockstack will share all information you provide in connection with the Program(including product usage and spend data), to our VC partners in Signature Fund.

                          You should not submit or provide anything you consider confidential or proprietary as part of the Program. Due to the large number of submissions we receive, we cannot be responsible for maintaining submitted information or materials in confidence. Accordingly, you represent and agree that all information you provide in connection with the Program will be non-confidential, and you acknowledge and agree that such information will not be held in confidence or restricted from use or disclosure in any way.

                          There are a large number of applicants for Signature Fund. Accordingly, we make no promises or guarantees that you will receive funding or even be invited to apply. Blockstack, Signature Fund and its VC partners have no obligation or duty to you unless and until a definitive agreement regarding funding is executed and delivered by all relevant parties (if at all).

                          NOTWITHSTANDING ANYTHING TO THE CONTRARY, Blockstack, THE Signature Fund AND ITS VC PARTNERS WILL NOT BE RESPONSIBLE OR LIABLE, UNDER ANY LEGAL OR EQUITABLE THEORY, FOR ANY INDIRECT, INCIDENTAL, SPECIAL OR CONSEQUENTIAL DAMAGES OF ANY KIND OR FOR ANY AMOUNT IN THE AGGREGATE IN EXCESS OF FIFTY DOLLARS ($50).

                          These Signature Fund Submission Terms are governed by the laws of the State of New York.

      </DocumentTitle>
    )
  }

}

export default connect(mapStateToProps, mapDispatchToProps)(FundingPage)<commit_msg>added temporary form link to buttons<commit_after>'use strict'

import {Component}          from 'react'
import {Link}               from 'react-router'
import DocumentTitle        from 'react-document-title'
import {bindActionCreators} from 'redux'
import {connect}            from 'react-redux'

import {BlogActions}       from '../datastore/Blog'
import {StatsActions}      from '../datastore/Stats'
import Image               from '../components/Image'
import Header              from '../components/Header'
import TokenBanner         from '../components/TokenBanner'
import ContentSection      from '../components/ContentSection'
import VideosPresentation  from '../components/VideosPresentation'
import {featuredApps}      from '../config'

function mapStateToProps(state) {
  return {
    posts: state.blog.posts,
    stats: state.stats,
  }
}

function mapDispatchToProps(dispatch) {
  return bindActionCreators(
    Object.assign({}, BlogActions, StatsActions),
    dispatch
  )
}

class FundingPage extends Component {

  render() {
    return (
      <DocumentTitle title="Blockstack Signature Fund">

            <TokenBanner />

                <Image className="blockstack-signature-fund-logo-md m-t-55 m-b-45"
                  src="/images/logos/blockstack-signature-fund-logo-rev.svg"
                  retinaSupport={false} />

                  "Money is bringing everybody in, but the thing we are creating is larger than ourselves, larger than money."

                  — Naval Ravikant at Blockstack Summit 2017

                  <Link to="https://goo.gl/forms/5jAfojqWiqe4vBzb2" target="_blank" className="btn btn-electric-blue btn-block">
                    Apply Here!
                  </Link>

                      The Signature Fund for Blockstack is a $25M fund aimed at growing an ecosystem of decentralized applications on Blockstack.

                      We partnered with thesis-driven VC’s thesis-driven VC's who're aligned with our vision of a decentralized internet like Lux Capital, Rising Tide, Compound, OpenOcean, and VersionOne to fund app developers and teams looking to build their apps on the new fully decentralized internet. App creators will benefit directly from the deep expertise and insight of these experienced investors.

                      Additionally, those who apply will be first to hear 'x-prize' style prizes/bounties for large initiatives like building a decentralized microblogging platform, funded by investors like Naval Ravikant (founder, AngelList), Albert Wenger (managing partner, USV), and more

                        “Less white paper hype, more working code.”

                        — Jeremy Welch, Casa App Founder at Blockstack Summit 2017

                        There’s a lot of excitement about building decentralized applications, but we know it is still early days. At Blockstack we’ve created the core infrastructure to enable developers to build these applications, but we realize that to increase an app’s chances of success, it will require access to capital and tools to bootstrap networks.

                         We think in the long term it’s not just about raising a round or a token, but more about forging an ecosystem that keeps your application thriving. Here are just a few of the methods opening up to applications being built on Blockstack:

VC-led Funding: Blockstack Apps will get access to and capital from some of the best minds in the space.

Token: Blockstack Apps will be able to offer tokens on top of the Blockstack ecosystem, just like ERC20 tokens on Ethereum.

Advanced Payments: Forward a percentage of your app’s subscription fees to specific names/addresses to incentivize app-building behavior.

                        These are just the first steps to building an app ecosystem for the decentralized internet, and we expect tools to evolve and capabilities to grow.

                      Why Apply?

                      These is an early step to building a sustainable, responsible ecosystem.
                      Just like building skyscraper, we are now pouring the concrete foundation.
                      There will be many more layers to come.

                      How to Apply

                      You can apply as an individual or team by filling out the application form below or at the top of the page:

                      <Link to="https://goo.gl/forms/5jAfojqWiqe4vBzb2" target="_blank" className="btn btn-electric-blue btn-block">
                        Apply Here!
                      </Link>

                      Once you apply, we’ll provide you with some starter materials to get started building apps on Blockstack.

                      Members of the Blockstack team will reach out to you if there’s interest in working more closely to build a team (if needed) and a product using Blockstack. Projects will be selected for funding consideration and support.

                      What is Blockstack?

                      Blockstack is a new fully decentralized internet that comes with a full stack of open-source developer tools to build and bootstrap decentralized applications and protocol ecosystems.

                      In Partnership with:

                        <Link to="https://compound.vc/" target="_blank">
                          <Image className="col-img partnerLogo" src="/images/logos/partner-logo-compound.svg"
                            retinaSupport={false} />
                        </Link>

                        <Link to="http://versionone.vc/" target="_blank">
                          <Image className="col-img partnerLogo" src="/images/logos/partner-logo-versionone.png"
                            retinaSupport={false} />
                        </Link>

                        <Link to="http://rtf.vc/" target="_blank">
                          <Image className="col-img partnerLogo" src="/images/logos/partner-logo-risingtide.png"
                            retinaSupport={false} />
                        </Link>

                        <Link to="http://www.luxcapital.com/" target="_blank">
                          <Image className="col-img partnerLogo-lux" src="/images/logos/partner-logo-lux.png"
                            retinaSupport={false} />
                        </Link>

                        <Link to="http://openocean.vc/" target="_blank">
                          <Image className="col-img partnerLogo" src="/images/logos/partner-logo-openocean.png"
                            retinaSupport={false} />
                        </Link>

                      Terms & Conditions

                      Thank you for your interest in Signature Fund. By submitting any information or materials to Blockstack regarding the Signature Fund program and application process (the "Program"), you (and the entity or business you represent) (collectively, "you") agree to be bound by the following terms:

                          You acknowledge and agree that Blockstack will share all information you provide in connection with the Program(including product usage and spend data), to our VC partners in Signature Fund.

                          You should not submit or provide anything you consider confidential or proprietary as part of the Program. Due to the large number of submissions we receive, we cannot be responsible for maintaining submitted information or materials in confidence. Accordingly, you represent and agree that all information you provide in connection with the Program will be non-confidential, and you acknowledge and agree that such information will not be held in confidence or restricted from use or disclosure in any way.

                          There are a large number of applicants for Signature Fund. Accordingly, we make no promises or guarantees that you will receive funding or even be invited to apply. Blockstack, Signature Fund and its VC partners have no obligation or duty to you unless and until a definitive agreement regarding funding is executed and delivered by all relevant parties (if at all).

                          NOTWITHSTANDING ANYTHING TO THE CONTRARY, Blockstack, THE Signature Fund AND ITS VC PARTNERS WILL NOT BE RESPONSIBLE OR LIABLE, UNDER ANY LEGAL OR EQUITABLE THEORY, FOR ANY INDIRECT, INCIDENTAL, SPECIAL OR CONSEQUENTIAL DAMAGES OF ANY KIND OR FOR ANY AMOUNT IN THE AGGREGATE IN EXCESS OF FIFTY DOLLARS ($50).

                          These Signature Fund Submission Terms are governed by the laws of the State of New York.

      </DocumentTitle>
    )
  }

}

export default connect(mapStateToProps, mapDispatchToProps)(FundingPage)<|endoftext|>


<commit_before>(function ($) {
  var queryParser = function (a) {
      var i, p, b = {};
      if (a === "") {
        return {};
      }
      for (i = 0; i < a.length; i += 1) {
        p = a[i].split('=');
        if (p.length === 2) {
          b[p[0]] = decodeURIComponent(p[1].replace(/\+/g, " "));
        }
      }
      return b;
    };
  $.queryParams = function () {
    return queryParser(window.location.search.substr(1).split('&'));
  };
  $.hashParams = function () {
    return queryParser(window.location.hash.substr(1).split('&'));
  };

  window.Swiftype = window.Swiftype || {};
  Swiftype.root_url = Swiftype.root_url || 'https://api.swiftype.com';
  Swiftype.pingUrl = function(endpoint, callback) {
    var to = setTimeout(callback, 350);
    var img = new Image();
    img.onload = img.onerror = function() {
      clearTimeout(to);
      callback();
    };
    img.src = endpoint;
    return false;
  };
  Swiftype.pingSearchResultClick = function (engineKey, docId, callback) {
    var params = {
      t: new Date().getTime(),
      engine_key: engineKey,
      doc_id: docId,
      q: Swiftype.currentQuery
    };
    var url = Swiftype.root_url + '/api/v1/public/analytics/pc?' + $.param(params);
    Swiftype.pingUrl(url, callback);
  };

  $.fn.swiftypeSearch = function (options) {
    var options = $.extend({}, $.fn.swiftypeSearch.defaults, options);

    return this.each(function () {
      var $this = $(this);
      var config = $.meta ? $.extend({}, options, $this.data()) : options;
      $this.data('swiftype-config-search', config);

      $this.selectedCallback = function (data) {
        return function (e) {
          var $el = $(this);
          e.preventDefault();
          Swiftype.pingSearchResultClick(config.engineKey, data['id'], function() {
            config.onComplete($el);
          });
        };
      };

      $this.registerResult = function ($element, data) {
        $element.data('swiftype-item', data);
        $('a', $element).click($this.selectedCallback(data));
      };

      $this.getContentCache = function () {
        return $('#' + contentCacheId);
      };

      var $resultContainer = $(config.resultContainingElement),
        initialContentOfResultContainer = $resultContainer.html(),
        contentCacheId = 'st-content-cache',
        $contentCache = $this.getContentCache();

      var setSearchHash = function (query, page) {
          location.hash = "stq=" + encodeURIComponent(query) + "&stp=" + page;
        };

      var submitSearch = function (query, options) {
          options = $.extend({
            page: 1
          }, options);
          var params = {};

          if (!$contentCache.length) {
            $resultContainer.after("

");
            $contentCache.html(initialContentOfResultContainer).hide();
          }
          config.loadingFunction(query, $resultContainer);

          Swiftype.currentQuery = query;
          params['q'] = query;
          params['engine_key'] = config.engineKey;
          params['page'] = options.page;

          function handleFunctionParam(field) {
            if (field !== undefined) {
              var evald = field;
              if (typeof evald === 'function') {
                evald = evald.call();
              }
              return evald;
            }
            return undefined;
          }

          params['per_page'] = handleFunctionParam(config.perPage);
          params['search_fields'] = handleFunctionParam(config.searchFields);
          params['fetch_fields'] = handleFunctionParam(config.fetchFields);
          params['facets'] = handleFunctionParam(config.facets);
          params['filters'] = handleFunctionParam(config.filters);
          params['document_types'] = handleFunctionParam(config.documentTypes);
          params['functional_boosts'] = handleFunctionParam(config.functionalBoosts);
          params['sort_field'] = handleFunctionParam(config.sortField);
          params['sort_direction'] = handleFunctionParam(config.sortDirection);
          params['spelling'] = handleFunctionParam(config.spelling);

          $.getJSON(Swiftype.root_url + "/api/v1/public/engines/search.json?callback=?", params).success(renderSearchResults);
        };

      $(window).hashchange(function () {
        var params = $.hashParams();
        if (params.stq) {
          submitSearch(params.stq, {
            page: params.stp
          });
        } else {
          var $contentCache = $this.getContentCache();
          if ($contentCache.length) {
            $resultContainer.html($contentCache.html());
            $contentCache.remove();
          }
        }
      });

      var $containingForm = $this.parents('form');
      if ($containingForm) {
        $containingForm.bind('submit', function (e) {
          e.preventDefault();
          var searchQuery = $this.val();
          setSearchHash(searchQuery, 1);
        });
      }

      $(document).on('click', '[data-hash][data-page]', function (e) {
        e.preventDefault();
        var $this = $(this);
        setSearchHash($.hashParams().stq, $this.data('page'));
      });

      $(document).on('click', '[data-hash][data-spelling-suggestion]', function (e) {
        e.preventDefault();
        var $this = $(this);
        setSearchHash($this.data('spelling-suggestion'), 1);
      });

      var renderSearchResults = function (data) {
        if (typeof config.preRenderFunction === 'function') {
          config.preRenderFunction.call($this, data);
        }

        config.renderResultsFunction($this.getContext(), data);

        if (typeof config.postRenderFunction === 'function') {
          config.postRenderFunction.call($this, data);
        }
      };

      $this.getContext = function () {
        return {
          config: config,
          resultContainer: $resultContainer,
          registerResult: $this.registerResult
        };
      };

      $(window).hashchange(); // if the swiftype query hash is present onload (maybe the user is pressing the back button), submit a query onload
    });
  };

  var renderPagination = function (ctx, resultInfo) {
    var maxPagesType, maxPages = -1,
      config = ctx.config;
    $.each(resultInfo, function(documentType, typeInfo) {
      if (typeInfo.num_pages > maxPages) {
        maxPagesType = documentType;
        maxPages = typeInfo.num_pages;
      }
    });
    var currentPage = resultInfo[maxPagesType].current_page,
      totalPages = resultInfo[maxPagesType].num_pages;

    $(config.renderPaginationForType(maxPagesType, currentPage, totalPages)).appendTo(ctx.resultContainer);
  };

  var normalize = function (str) {
      return $.trim(str).toLowerCase();
    };

  function htmlEscape(str) {
    return String(str).replace(/&/g, '&').replace(/"/g, '"').replace(/'/g, ''').replace(/</g, '<').replace(/>/g, '>');
  }

  var defaultRenderResultsFunction = function (ctx, data) {
    var $resultContainer = ctx.resultContainer,
      config = ctx.config;

    $resultContainer.html('');

    $.each(data.records, function (documentType, items) {
      $.each(items, function (idx, item) {
        ctx.registerResult($(config.renderFunction(documentType, item)).appendTo($resultContainer), item);
      });
    });

    renderPagination(ctx, data.info);
  };

  var defaultRenderFunction = function (document_type, item) {
      return '

' + htmlEscape(item['title']) + '

';
    };

  var defaultLoadingFunction = function(query, $resultContainer) {
      $resultContainer.html('
loading...
');
    };

  var defaultOnComplete = function(elem) {
    window.location = elem.attr('href');
  };

  var defaultPostRenderFunction = function(data) {
    var totalResultCount = 0;
    var $resultContainer = this.getContext().resultContainer;
    var spellingSuggestion = null;

    if (data['info']) {
      $.each(data['info'], function(index, value) {
        totalResultCount += value['total_result_count'];
        if ( value['spelling_suggestion'] ) {
          spellingSuggestion = value['spelling_suggestion']['text'];
        }

      });
    }

    if (totalResultCount === 0) {
      $resultContainer.html("
No results found.
");
    }

    if (spellingSuggestion !== null) {
      $resultContainer.append('
Did you mean ' + spellingSuggestion + '?
');
    }
  };

  var defaultRenderPaginationForType = function (type, currentPage, totalPages) {
      var pages = '
',
        previousPage, nextPage;
      if (currentPage != 1) {
        previousPage = currentPage - 1;
        pages = pages + '« previous';
      }
      if (currentPage < totalPages) {
        nextPage = currentPage + 1;
        pages = pages + 'next »';
      }
      pages += '
';
      return pages;
    };

  $.fn.swiftypeSearch.defaults = {
    attachTo: undefined,
    documentTypes: undefined,
    facets: undefined,
    filters: undefined,
    engineKey: undefined,
    searchFields: undefined,
    functionalBoosts: undefined,
    sortField: undefined,
    sortDirection: undefined,
    fetchFields: undefined,
    preRenderFunction: undefined,
    postRenderFunction: defaultPostRenderFunction,
    loadingFunction: defaultLoadingFunction,
    renderResultsFunction: defaultRenderResultsFunction,
    renderFunction: defaultRenderFunction,
    renderPaginationForType: defaultRenderPaginationForType,
    onComplete: defaultOnComplete,
    perPage: 10,
    spelling: 'strict'
  };
})(jQuery);
<commit_msg>enable search attribution<commit_after>(function ($) {
  var queryParser = function (a) {
      var i, p, b = {};
      if (a === "") {
        return {};
      }
      for (i = 0; i < a.length; i += 1) {
        p = a[i].split('=');
        if (p.length === 2) {
          b[p[0]] = decodeURIComponent(p[1].replace(/\+/g, " "));
        }
      }
      return b;
    };
  $.queryParams = function () {
    return queryParser(window.location.search.substr(1).split('&'));
  };
  $.hashParams = function () {
    return queryParser(window.location.hash.substr(1).split('&'));
  };

  window.Swiftype = window.Swiftype || {};
  Swiftype.root_url = Swiftype.root_url || 'https://api.swiftype.com';
  Swiftype.pingUrl = function(endpoint, callback) {
    var to = setTimeout(callback, 350);
    var img = new Image();
    img.onload = img.onerror = function() {
      clearTimeout(to);
      callback();
    };
    img.src = endpoint;
    return false;
  };
  Swiftype.pingSearchResultClick = function (engineKey, docId, callback) {
    var params = {
      t: new Date().getTime(),
      engine_key: engineKey,
      doc_id: docId,
      q: Swiftype.currentQuery
    };
    var url = Swiftype.root_url + '/api/v1/public/analytics/pc?' + $.param(params);
    Swiftype.pingUrl(url, callback);
  };

  $.fn.swiftypeSearch = function (options) {
    var options = $.extend({}, $.fn.swiftypeSearch.defaults, options);

    return this.each(function () {
      var $this = $(this);
      var config = $.meta ? $.extend({}, options, $this.data()) : options;
      $this.data('swiftype-config-search', config);

      $this.selectedCallback = function (data) {
        return function (e) {
          var $el = $(this);
          e.preventDefault();
          Swiftype.pingSearchResultClick(config.engineKey, data['id'], function() {
            config.onComplete($el);
          });
        };
      };

      $this.registerResult = function ($element, data) {
        $element.data('swiftype-item', data);
        $('a', $element).click($this.selectedCallback(data));
      };

      $this.getContentCache = function () {
        return $('#' + contentCacheId);
      };

      var $resultContainer = $(config.resultContainingElement),
        initialContentOfResultContainer = $resultContainer.html(),
        contentCacheId = 'st-content-cache',
        $contentCache = $this.getContentCache();

      var setSearchHash = function (query, page) {
          location.hash = "stq=" + encodeURIComponent(query) + "&stp=" + page;
        };

      var submitSearch = function (query, options) {
          options = $.extend({
            page: 1
          }, options);
          var params = {};

          if (!$contentCache.length) {
            $resultContainer.after("

");
            $contentCache.html(initialContentOfResultContainer).hide();
          }
          config.loadingFunction(query, $resultContainer);

          Swiftype.currentQuery = query;
          params['q'] = query;
          params['engine_key'] = config.engineKey;
          params['page'] = options.page;

          function handleFunctionParam(field) {
            if (field !== undefined) {
              var evald = field;
              if (typeof evald === 'function') {
                evald = evald.call();
              }
              return evald;
            }
            return undefined;
          }

          params['per_page'] = handleFunctionParam(config.perPage);
          params['search_fields'] = handleFunctionParam(config.searchFields);
          params['fetch_fields'] = handleFunctionParam(config.fetchFields);
          params['facets'] = handleFunctionParam(config.facets);
          params['filters'] = handleFunctionParam(config.filters);
          params['document_types'] = handleFunctionParam(config.documentTypes);
          params['functional_boosts'] = handleFunctionParam(config.functionalBoosts);
          params['sort_field'] = handleFunctionParam(config.sortField);
          params['sort_direction'] = handleFunctionParam(config.sortDirection);
          params['spelling'] = handleFunctionParam(config.spelling);

          $.ajax({
            dataType: "json",
            url: Swiftype.root_url + "/api/v1/public/engines/search.json?callback=?",
            data: params,
            xhrFields: { withCredentials: true },
            success: renderSearchResults
          });
        };

      $(window).hashchange(function () {
        var params = $.hashParams();
        if (params.stq) {
          submitSearch(params.stq, {
            page: params.stp
          });
        } else {
          var $contentCache = $this.getContentCache();
          if ($contentCache.length) {
            $resultContainer.html($contentCache.html());
            $contentCache.remove();
          }
        }
      });

      var $containingForm = $this.parents('form');
      if ($containingForm) {
        $containingForm.bind('submit', function (e) {
          e.preventDefault();
          var searchQuery = $this.val();
          setSearchHash(searchQuery, 1);
        });
      }

      $(document).on('click', '[data-hash][data-page]', function (e) {
        e.preventDefault();
        var $this = $(this);
        setSearchHash($.hashParams().stq, $this.data('page'));
      });

      $(document).on('click', '[data-hash][data-spelling-suggestion]', function (e) {
        e.preventDefault();
        var $this = $(this);
        setSearchHash($this.data('spelling-suggestion'), 1);
      });

      var renderSearchResults = function (data) {
        if (typeof config.preRenderFunction === 'function') {
          config.preRenderFunction.call($this, data);
        }

        config.renderResultsFunction($this.getContext(), data);

        if (typeof config.postRenderFunction === 'function') {
          config.postRenderFunction.call($this, data);
        }
      };

      $this.getContext = function () {
        return {
          config: config,
          resultContainer: $resultContainer,
          registerResult: $this.registerResult
        };
      };

      $(window).hashchange(); // if the swiftype query hash is present onload (maybe the user is pressing the back button), submit a query onload
    });
  };

  var renderPagination = function (ctx, resultInfo) {
    var maxPagesType, maxPages = -1,
      config = ctx.config;
    $.each(resultInfo, function(documentType, typeInfo) {
      if (typeInfo.num_pages > maxPages) {
        maxPagesType = documentType;
        maxPages = typeInfo.num_pages;
      }
    });
    var currentPage = resultInfo[maxPagesType].current_page,
      totalPages = resultInfo[maxPagesType].num_pages;

    $(config.renderPaginationForType(maxPagesType, currentPage, totalPages)).appendTo(ctx.resultContainer);
  };

  var normalize = function (str) {
      return $.trim(str).toLowerCase();
    };

  function htmlEscape(str) {
    return String(str).replace(/&/g, '&').replace(/"/g, '"').replace(/'/g, ''').replace(/</g, '<').replace(/>/g, '>');
  }

  var defaultRenderResultsFunction = function (ctx, data) {
    var $resultContainer = ctx.resultContainer,
      config = ctx.config;

    $resultContainer.html('');

    $.each(data.records, function (documentType, items) {
      $.each(items, function (idx, item) {
        ctx.registerResult($(config.renderFunction(documentType, item)).appendTo($resultContainer), item);
      });
    });

    renderPagination(ctx, data.info);
  };

  var defaultRenderFunction = function (document_type, item) {
      return '

' + htmlEscape(item['title']) + '

';
    };

  var defaultLoadingFunction = function(query, $resultContainer) {
      $resultContainer.html('
loading...
');
    };

  var defaultOnComplete = function(elem) {
    window.location = elem.attr('href');
  };

  var defaultPostRenderFunction = function(data) {
    var totalResultCount = 0;
    var $resultContainer = this.getContext().resultContainer;
    var spellingSuggestion = null;

    if (data['info']) {
      $.each(data['info'], function(index, value) {
        totalResultCount += value['total_result_count'];
        if ( value['spelling_suggestion'] ) {
          spellingSuggestion = value['spelling_suggestion']['text'];
        }

      });
    }

    if (totalResultCount === 0) {
      $resultContainer.html("
No results found.
");
    }

    if (spellingSuggestion !== null) {
      $resultContainer.append('
Did you mean ' + spellingSuggestion + '?
');
    }
  };

  var defaultRenderPaginationForType = function (type, currentPage, totalPages) {
      var pages = '
',
        previousPage, nextPage;
      if (currentPage != 1) {
        previousPage = currentPage - 1;
        pages = pages + '« previous';
      }
      if (currentPage < totalPages) {
        nextPage = currentPage + 1;
        pages = pages + 'next »';
      }
      pages += '
';
      return pages;
    };

  $.fn.swiftypeSearch.defaults = {
    attachTo: undefined,
    documentTypes: undefined,
    facets: undefined,
    filters: undefined,
    engineKey: undefined,
    searchFields: undefined,
    functionalBoosts: undefined,
    sortField: undefined,
    sortDirection: undefined,
    fetchFields: undefined,
    preRenderFunction: undefined,
    postRenderFunction: defaultPostRenderFunction,
    loadingFunction: defaultLoadingFunction,
    renderResultsFunction: defaultRenderResultsFunction,
    renderFunction: defaultRenderFunction,
    renderPaginationForType: defaultRenderPaginationForType,
    onComplete: defaultOnComplete,
    perPage: 10,
    spelling: 'strict'
  };
})(jQuery);
<|endoftext|>


<commit_before>var Factory = function (dialogs, options) {
  this.dialogs = dialogs;

  this.options = options || {};
  this.config = options.config || {};
  this.templates = options.templates || {};
};

Factory.prototype.createDialog = function (dialog, options) {
  var opts = options || {};
  opts.dialog = dialog;

  var Dialog = this.dialogs.get(dialog.type);

  // add any classname if defined
  if (dialog.className) {
    opts.className = Dialog.prototype.className + ' ' + dialog.className;
  }

  // instanciate dialog
  return new Dialog(opts);
};

Factory.prototype.create = function (name, options) {
  if (!name) {
    return;
  }

  // enable the slug to be defined as an object
  var dialog;

  if ('[object Object]' === name.toString()) {
    var _name = name.name || name.type;
    if (this.config.dialogs[_name]) {
      dialog = _.extend({}, this.config.dialogs[_name], name);
    }
  }
  else {
    dialog = this.config.dialogs[name];
  }

  if (!dialog) {
    return;
  }

  return this.createDialog(dialog, options);
};

Factory.prototype.render = function (region, slug, options) {
  if (!region) {
    return;
  }

  // extract region options if any that will be passed to region.show call.
  var regionOptions = {};

  if (options && options.hasOwnProperty('region')) {
    regionOptions = options.region;
    // remove them from options are they are explicitly for region
    delete options.region;
  }

  var dialog = this.create(slug, options);

  if (!dialog) {
    return false;
  }

  region.show(dialog, regionOptions);

  return dialog;
};
<commit_msg>refactor(factory): simplify dialog creation using config object<commit_after>var Factory = function (dialogs, options) {
  this.dialogs = dialogs;

  this.options = options || {};
  this.config = options.config || {};
};

Factory.prototype.createDialog = function (options) {
  var opts = options || {};

  var Dialog = this.dialogs.get(options.type);

  // add any classname if defined
  if (options.config && options.config.className) {
    opts.className = Dialog.prototype.className + ' ' + options.config.className;
  }

  // instanciate dialog
  return new Dialog(opts);
};

Factory.prototype.create = function (options) {
  if (!options) {
    return;
  }

  // enable the slug to be defined as an object
  var dialog;

  if ('[object Object]' === options.toString()) {
    var _name = options.name || options.type;
    if (this.config.dialogs[_name]) {
      dialog = _.extend({}, this.config.dialogs[_name], options);
    }
  }
  else {
    dialog = this.config.dialogs[options];
  }

  if (!dialog) {
    return;
  }

  return this.createDialog(dialog);
};

Factory.prototype.render = function (region, config, options) {
  if (!region) {
    return;
  }

  var dialog = this.create(config);

  if (!dialog) {
    return false;
  }

  region.show(dialog, options);

  return dialog;
};
<|endoftext|>


<commit_before>'use strict';

var Backbone = require('../shims/backbone');
var View = Backbone.View;
var templates = require('../lib/templates');

module.exports = View.extend({
  pageTitle: 'Monica Macovei Presedinte | Voluntariat',
  template: templates.pages.voluntariat,

  render: function () {
    this.$el.html(this.template());
    this.romaniaCoords = {
      latitude: 45.94,
      longitude: 25.00
    };
    this.wwCoords = {
      latitude: 35.7466317,
      longitude: -39.5317294
    };
    this.generateMap();
    return this;
  },

  events: {
    'click #romaniaCenters': 'addMarkersRomania',
    'click #worldWideCenters': 'addMarkersWW'
  },

  generateMap: function () {
    var lat = this.romaniaCoords.latitude;
    var long = this.romaniaCoords.longitude;
    this.map = new window.GMaps({
      el: this.$('#map')[0],
      lat: lat,
      lng: long,
      width: '100%',
      height: '25em',
      zoom: 6
    });
    this.addMarkersRomania();

    var self = this;
    setTimeout(function () {
      self.map.refresh();
      self.map.setCenter(self.romaniaCoords.latitude, self.romaniaCoords.longitude);
    }, 1);

  },
  addMarkersRomania: function () {
    var map = this.map;
    map.setCenter(this.romaniaCoords.latitude, this.romaniaCoords.longitude);
    map.setZoom(6);
    map.addMarker({
      lat: 44.437917,
      lng: 26.094637,
      title: 'Bucuresti',
      infoWindow: {
        content: '
Coordonatori: Alina Daniela Bogdan & Mircea Serdin
031.860.11.30
team@macoveipresedinte.ro
'
      }
    });
    map.addMarker({
      lat: 46.783442,
      lng: 23.616512,
      title: 'Cluj-Napoca',
      infoWindow: {
        content: '
Coordonator: Andreea Rusu
0757.065.197
Andreea.rusu.cj@gmail.com
 Punct depunere semnaturi: Calea Turzii nr.18-Cafeneaua "La Perne"
'
      }
    });
    map.addMarker({
      lat: 44.181357,
      lng: 28.629339,
      title: 'Constanta',
      infoWindow: {
        content: '
Coordonator: Mihai Petre
0744.340.918
mihaipetre77@yahoo.com
'
      }
    });
    map.addMarker({
      lat: 45.437678,
      lng: 28.047494,
      title: 'Galati',
      infoWindow: {
        content: '
Coordonator: George Schin
0744.613.117
schingeorge@yahoo.com
'
      }
    });
    map.addMarker({
      lat: 46.582,
      lng: 26.912,
      title: 'Bacau',
      infoWindow: {
        content: '
Coordonator: Petrica Danila
0745.542.626
petricadanila@gmail.com

Coordonator: Platon Mihai
 0740.042.611
 plutonserv@yahoo.com
Punct depunere semnaturi: Calea Moldovei, nr. 35
'
      }
    });
  map.addMarker({
      lat: 47.7375721,
      lng: 26.6594085,
      title: 'Botosani',
      infoWindow: {
        content: '
Coordonator: Lucian Buium
0751.401.127
luciabuium700@yahoo.com

'
      }
    });
  map.addMarker({
      lat: 45.694594,
      lng: 27.189102,
      title: 'Focsani',
      infoWindow: {
        content: '
Coordonator: Mariana Bondila
0723.531.486
marianabondila@yahoo.com
 Punct depunere semnaturi: Str. Revolutiei, nr. 19 (Sud, magazinul alimentar)
'
      }
    });
  map.addMarker({
      lat: 46.061722,
      lng: 23.584213,
      title: 'Alba Iulia',
      infoWindow: {
        content: '
Coordonator:  Ciprian Cucu
0722.733.831
cucu.ciprian@gmail.com
'
      }
    });
  map.addMarker({
      lat: 47.067297,
      lng: 26.665534,
      title: 'Oradea',
      infoWindow: {
        content: '
Coordonator: Radu Popovici
0744.570.848
maiaduc@gmail.com
 Punct depunere semnaturi: str.Calea Aradului, nr. 59
'
      }
    });
     map.addMarker({
       lat: 47.154667,
       lng: 27.590446,
       title: 'Iasi',
       infoWindow: {
         content: '
Coordonator: Viorel Paraschiv
0748.997.793
paraschiv03@gmail.com
'
       }
     });
    map.addMarker({
       lat: 45.754809,
       lng: 21.228160,
       title: 'Timisoara',
       infoWindow: {
         content: '
Coordonator:
Piroska Bogdan
0727 214 432
 piribogdan@gmail.com
'
       }
     });
    map.addMarker({
      lat: 45.871769,
      lng: 22.916793,
      title: 'Deva',
      infoWindow: {
        content: '
Coordonator: Mirela Cristea
0769.684.820
mircristea@yahoo.fr
 Punct depunere semnaturi: Str, Dorobantilor, nr. 30 (Patiseria Paticof, langa Foricon)
'
      }
    });
    map.addMarker({
      lat: 46.543967,
      lng: 24.561481,
      title: 'Târgu Mureș',
      infoWindow: {
        content: '
Coordonator: Dan Masca
0745.992.463
dan@reea.net
 Punct depunere semnaturi: Piata Republicii, nr. 43
'
      }
    });
    map.addMarker({
      lat: 47.047522,
      lng: 21.919097,
      title: 'Oradea',
      infoWindow: {
        content: '
Coordonator: Radu Popovici
0744.570.848
maiaduc@gmail.com
 Punct depunere semnaturi: str.Calea Aradului, nr. 59
'
      }
    });
    map.addMarker({
      lat: 44.318858,
      lng: 23.806686,
      title: 'Craiova',
      infoWindow: {
        content: '
Coordonator:  Tiberiu Alexandru Brindusoiu
0728.253.102
tialexius@yahoo.com
'
      }
    });
    //map.addMarker({
     // lat: 46.164287,
    //  lng: 24.354286,
    //  title: 'Medias',
    //  infoWindow: {
    //    content: '
Coordonator: Tudor Dinca

tcdinca@gmail.com
'
    //  }
    //});
    // map.setZoom(9);
    // map.panTo(new window.google.maps.LatLng(40.7056308,-73.9780035));
    // setTimeout( function() {
    //   map.setZoom(14);
    // }, 2000);
  },

  addMarkersWW: function () {
    var map = this.map;
    map.setCenter(this.wwCoords.latitude, this.wwCoords.longitude);
    map.setZoom(2);
    map.addMarker({
      lat: 44.437917,
      lng: 26.094637,
      title: 'Bucuresti',
      infoWindow: {
        content: '
Coordonatori: Alina Daniela Bogdan & Mircea Serdin
031.860.11.30
team@macoveipresedinte.ro
'
      }
    });
  }

});
<commit_msg>added Braila<commit_after>'use strict';

var Backbone = require('../shims/backbone');
var View = Backbone.View;
var templates = require('../lib/templates');

module.exports = View.extend({
  pageTitle: 'Monica Macovei Presedinte | Voluntariat',
  template: templates.pages.voluntariat,

  render: function () {
    this.$el.html(this.template());
    this.romaniaCoords = {
      latitude: 45.94,
      longitude: 25.00
    };
    this.wwCoords = {
      latitude: 35.7466317,
      longitude: -39.5317294
    };
    this.generateMap();
    return this;
  },

  events: {
    'click #romaniaCenters': 'addMarkersRomania',
    'click #worldWideCenters': 'addMarkersWW'
  },

  generateMap: function () {
    var lat = this.romaniaCoords.latitude;
    var long = this.romaniaCoords.longitude;
    this.map = new window.GMaps({
      el: this.$('#map')[0],
      lat: lat,
      lng: long,
      width: '100%',
      height: '25em',
      zoom: 6
    });
    this.addMarkersRomania();

    var self = this;
    setTimeout(function () {
      self.map.refresh();
      self.map.setCenter(self.romaniaCoords.latitude, self.romaniaCoords.longitude);
    }, 1);

  },
  addMarkersRomania: function () {
    var map = this.map;
    map.setCenter(this.romaniaCoords.latitude, this.romaniaCoords.longitude);
    map.setZoom(6);
    map.addMarker({
      lat: 44.437917,
      lng: 26.094637,
      title: 'Bucuresti',
      infoWindow: {
        content: '
Coordonatori: Alina Daniela Bogdan & Mircea Serdin
031.860.11.30
team@macoveipresedinte.ro
'
      }
    });
    map.addMarker({
      lat: 46.783442,
      lng: 23.616512,
      title: 'Cluj-Napoca',
      infoWindow: {
        content: '
Coordonator: Andreea Rusu
0757.065.197
Andreea.rusu.cj@gmail.com
 Punct depunere semnaturi: Calea Turzii nr.18-Cafeneaua "La Perne"
'
      }
    });
    map.addMarker({
      lat: 44.181357,
      lng: 28.629339,
      title: 'Constanta',
      infoWindow: {
        content: '
Coordonator: Mihai Petre
0744.340.918
mihaipetre77@yahoo.com
'
      }
    });
    map.addMarker({
      lat: 45.437678,
      lng: 28.047494,
      title: 'Galati',
      infoWindow: {
        content: '
Coordonator: George Schin
0744.613.117
schingeorge@yahoo.com
'
      }
    });
    map.addMarker({
      lat: 46.582,
      lng: 26.912,
      title: 'Bacau',
      infoWindow: {
        content: '
Coordonator: Petrica Danila
0745.542.626
petricadanila@gmail.com

Coordonator: Platon Mihai
 0740.042.611
 plutonserv@yahoo.com
Punct depunere semnaturi: Calea Moldovei, nr. 35
'
      }
    });
    map.addMarker({
      lat: 47.7375721,
      lng: 26.6594085,
      title: 'Botosani',
      infoWindow: {
        content: '
Coordonator: Lucian Buium
0751.401.127
luciabuium700@yahoo.com

'
      }
    });
    map.addMarker({
      lat: 45.694594,
      lng: 27.189102,
      title: 'Focsani',
      infoWindow: {
        content: '
Coordonator: Mariana Bondila
0723.531.486
marianabondila@yahoo.com
 Punct depunere semnaturi: Str. Revolutiei, nr. 19 (Sud, magazinul alimentar)
'
      }
    });
    map.addMarker({
      lat: 46.061722,
      lng: 23.584213,
      title: 'Alba Iulia',
      infoWindow: {
        content: '
Coordonator:  Ciprian Cucu
0722.733.831
cucu.ciprian@gmail.com
'
      }
    });
     map.addMarker({
       lat: 47.154667,
       lng: 27.590446,
       title: 'Iasi',
       infoWindow: {
         content: '
Coordonator: Viorel Paraschiv
0748.997.793
paraschiv03@gmail.com
'
       }
     });
    map.addMarker({
       lat: 45.754809,
       lng: 21.228160,
       title: 'Timisoara',
       infoWindow: {
         content: '
Coordonator:
Piroska Bogdan
0727 214 432
 piribogdan@gmail.com
'
       }
     });
    map.addMarker({
      lat: 45.871769,
      lng: 22.916793,
      title: 'Deva',
      infoWindow: {
        content: '
Coordonator: Mirela Cristea
0769.684.820
mircristea@yahoo.fr
 Punct depunere semnaturi: Str, Dorobantilor, nr. 30 (Patiseria Paticof, langa Foricon)
'
      }
    });
    map.addMarker({
      lat: 46.543967,
      lng: 24.561481,
      title: 'Târgu Mureș',
      infoWindow: {
        content: '
Coordonator: Dan Masca
0745.992.463
dan@reea.net
 Punct depunere semnaturi: Piata Republicii, nr. 43
'
      }
    });
    map.addMarker({
      lat: 47.047522,
      lng: 21.919097,
      title: 'Oradea',
      infoWindow: {
        content: '
Coordonator: Radu Popovici
0744.570.848
maiaduc@gmail.com
 Punct depunere semnaturi: str.Calea Aradului, nr. 59
'
      }
    });
    map.addMarker({
      lat: 44.318858,
      lng: 23.806686,
      title: 'Craiova',
      infoWindow: {
        content: '
Coordonator:  Tiberiu Alexandru Brindusoiu
0728.253.102
tialexius@yahoo.com
'
      }
    });
    map.addMarker({
      lat: 45.264700,
      lng: 27.961235,
      title: 'Braila',
      infoWindow: {
        content: '
Coordonator: Dragan Florin
0744.470.578
draganbr75@gmail.com

'
      }
    });
    //map.addMarker({
     // lat: 46.164287,
    //  lng: 24.354286,
    //  title: 'Medias',
    //  infoWindow: {
    //    content: '
Coordonator: Tudor Dinca

tcdinca@gmail.com
'
    //  }
    //});
    // map.setZoom(9);
    // map.panTo(new window.google.maps.LatLng(40.7056308,-73.9780035));
    // setTimeout( function() {
    //   map.setZoom(14);
    // }, 2000);
  },

  addMarkersWW: function () {
    var map = this.map;
    map.setCenter(this.wwCoords.latitude, this.wwCoords.longitude);
    map.setZoom(2);
    map.addMarker({
      lat: 44.437917,
      lng: 26.094637,
      title: 'Bucuresti',
      infoWindow: {
        content: '
Coordonatori: Alina Daniela Bogdan & Mircea Serdin
031.860.11.30
team@macoveipresedinte.ro
'
      }
    });
  }

});
<|endoftext|>


<commit_before>// Copyright (c) Nicolas Hoizey 2015
// Released under the MIT license
//
// PinboardInGoogle
// userscript to show your Pinboard bookmarks alongside Google Search results
// https://github.com/nhoizey/PinboardInGoogle/
//
// Author
// Nicolas Hoizey <nicolas@hoizey.com>
//
// --------------------------------------------------------------------
// This is a UserScript.
//
// To install it on Firefox, you need the Greasemonkey addon:
//   http://greasemonkey.mozdev.org/
// Nothing is needed to install it on Chrome
// --------------------------------------------------------------------
//
// ==UserScript==
// @name          PinboardInGoogle
// @description   shows your Pinboard bookmarks before Google Search results
// @icon          https://pinboard.in/bluepin.gif
// @namespace     com.gasteroprod.lab
// @version       1.2
// @updateURL     https://github.com/nhoizey/PinboardInGoogle/raw/master/PinboardInGoogle.user.js
// @include       http://www.google.*/*
// @include       https://www.google.*/*
// @require       https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js
// @grant         GM_xmlhttpRequest
// ==/UserScript==

(function(w, d) {
  var msg = '',
      html = '',
      queryStr = '',
      jsonUrl = '',
      jsonData = '';

  function handleSearch() {
    // Get the query value
    queryStr = d.querySelector('form[role=search] input[name=q]').value;

    if (undefined !== queryStr) {
      // Translate the query string to a list of tags
      queryStr = queryStr.replace(/[^\w]/g, " ");
      queryStr = queryStr.replace(/ +/g, " ");
      queryStr = queryStr.replace(/^ | $/g, "");

      // Generate Pinboard API JSON URL
      // https://feeds.pinboard.in/json/v1/u:nhoizey/t:24-70mm/t:canon?count=20
      queryStr = queryStr.replace(/\s*(\w+)\s*/g, "/t:$1");
      jsonUrl = 'https://feeds.pinboard.in/json/v1/u:nhoizey' + queryStr;
      jsonData = 'count=20'; // todo: doesn't seem to work

      // Request the API
      GM_xmlhttpRequest({
        method: 'GET',
        url: jsonUrl,
        data: jsonData,
        timeout: 10000, // 10 seconds
        headers: {
          'User-Agent': 'PinboardInGoogle',
          'Accept': 'application/json'
        },
        onload: function(responseDetails) {
          parseFeed(responseDetails);
        },
        onerror: function(responseDetails) {
          // Show the error message
          console.log('error…');
        }
      });
    }
  }

  function parseFeed(responseDetails) {
    var bookmarks = JSON.parse(responseDetails.response),
        nb = bookmarks.length,
        max = Math.min(nb, 20);

    if (nb > 0) {
      // Create the results container
      $('#res').prepend('

');

      // Add some style to it
      $('head').append('\
        '
      );

      html = '
Pinboard bookmarks how does it work?
';
      html += '
';
      for (var i = 0; i < max; i++) {
        html += '

';
        html += '
' + bookmarks[i].d + '
';
        html += '
' + bookmarks[i].t.join(', ') + '
';
        html += '' + bookmarks[i].n + '';
        html += '
';
      }
      html += '

';
      if (nb > 3) {
        html += '+ show more';
      }
      html += ' ';
      html += 'these bookmarks on Pinboard';
      html += '
';
    }
    $('#PinboardInGoogle').html(html);
  }

  $(document.querySelector('form[role=search] input[name=q]')).on('change', handleSearch);
  handleSearch();
})(window, document);
<commit_msg>"For small scripts, don't even bother with the @updateURL setting"<commit_after>// Copyright (c) Nicolas Hoizey 2015
// Released under the MIT license
//
// PinboardInGoogle
// userscript to show your Pinboard bookmarks alongside Google Search results
// https://github.com/nhoizey/PinboardInGoogle/
//
// Author
// Nicolas Hoizey <nicolas@hoizey.com>
//
// --------------------------------------------------------------------
// This is a UserScript.
//
// To install it on Firefox, you need the Greasemonkey addon:
//   http://greasemonkey.mozdev.org/
// Nothing is needed to install it on Chrome
// --------------------------------------------------------------------
//
// ==UserScript==
// @name          PinboardInGoogle
// @description   shows your Pinboard bookmarks before Google Search results
// @icon          https://pinboard.in/bluepin.gif
// @namespace     com.gasteroprod.lab
// @version       1.3
// @downloadURL   https://github.com/nhoizey/PinboardInGoogle/raw/master/PinboardInGoogle.user.js
// @include       http://www.google.*/*
// @include       https://www.google.*/*
// @require       https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js
// @grant         GM_xmlhttpRequest
// ==/UserScript==

(function(w, d) {
  var msg = '',
      html = '',
      queryStr = '',
      jsonUrl = '',
      jsonData = '';

  function handleSearch() {
    // Get the query value
    queryStr = d.querySelector('form[role=search] input[name=q]').value;

    if (undefined !== queryStr) {
      // Translate the query string to a list of tags
      queryStr = queryStr.replace(/[^\w]/g, " ");
      queryStr = queryStr.replace(/ +/g, " ");
      queryStr = queryStr.replace(/^ | $/g, "");

      // Generate Pinboard API JSON URL
      // https://feeds.pinboard.in/json/v1/u:nhoizey/t:24-70mm/t:canon?count=20
      queryStr = queryStr.replace(/\s*(\w+)\s*/g, "/t:$1");
      jsonUrl = 'https://feeds.pinboard.in/json/v1/u:nhoizey' + queryStr;
      jsonData = 'count=20'; // todo: doesn't seem to work

      // Request the API
      GM_xmlhttpRequest({
        method: 'GET',
        url: jsonUrl,
        data: jsonData,
        timeout: 10000, // 10 seconds
        headers: {
          'User-Agent': 'PinboardInGoogle',
          'Accept': 'application/json'
        },
        onload: function(responseDetails) {
          parseFeed(responseDetails);
        },
        onerror: function(responseDetails) {
          // Show the error message
          console.log('error…');
        }
      });
    }
  }

  function parseFeed(responseDetails) {
    var bookmarks = JSON.parse(responseDetails.response),
        nb = bookmarks.length,
        max = Math.min(nb, 20);

    if (nb > 0) {
      // Create the results container
      $('#res').prepend('

');

      // Add some style to it
      $('head').append('\
        '
      );

      html = '
Pinboard bookmarks how does it work?
';
      html += '
';
      for (var i = 0; i < max; i++) {
        html += '

';
        html += '
' + bookmarks[i].d + '
';
        html += '
' + bookmarks[i].t.join(', ') + '
';
        html += '' + bookmarks[i].n + '';
        html += '
';
      }
      html += '

';
      if (nb > 3) {
        html += '+ show more';
      }
      html += ' ';
      html += 'these bookmarks on Pinboard';
      html += '
';
    }
    $('#PinboardInGoogle').html(html);
  }

  $(document.querySelector('form[role=search] input[name=q]')).on('change', handleSearch);
  handleSearch();
})(window, document);
<|endoftext|>


<commit_before>var Factory = function (dialogs, options) {
  this.dialogs = dialogs;

  this.options = options || {};
  this.config = options.config || {};
  this.templates = options.templates || {};
};

Factory.prototype.createDialog = function (dialog, options) {
  var opts = options || {};
  opts.dialog = dialog;

  var Dialog = this.dialogs.get(dialog.type);

  // add any classname if defined
  if (dialog.className) {
    opts.className = Dialog.prototype.className + ' ' + dialog.className;
  }

  // instanciate dialog
  var view = new Dialog(opts);
  // we need to set the template before rendering the view
  // if no template has been attached to the view search for the main template registry
  if (!view.template) {
    view.template = this.templates[dialog.template || dialog.type];
  }

  return view;
};

Factory.prototype.create = function (slug, options) {
  if (!slug && !this.config.dialogs[slug]) {
    return;
  }

  var dialog = this.config.dialogs[slug];
  return this.createDialog(dialog, options);
};

Factory.prototype.render = function (region, slug, options) {
  if (!region) {
    return;
  }

  var dialog = this.create(slug, options);

  if (!dialog) {
    return false;
  }

  region.show(dialog);

  return dialog;
};
<commit_msg>fix(factory): fix condition about unknown dialog<commit_after>var Factory = function (dialogs, options) {
  this.dialogs = dialogs;

  this.options = options || {};
  this.config = options.config || {};
  this.templates = options.templates || {};
};

Factory.prototype.createDialog = function (dialog, options) {
  var opts = options || {};
  opts.dialog = dialog;

  var Dialog = this.dialogs.get(dialog.type);

  // add any classname if defined
  if (dialog.className) {
    opts.className = Dialog.prototype.className + ' ' + dialog.className;
  }

  // instanciate dialog
  var view = new Dialog(opts);
  // we need to set the template before rendering the view
  // if no template has been attached to the view search for the main template registry
  if (!view.template) {
    view.template = this.templates[dialog.template || dialog.type];
  }

  return view;
};

Factory.prototype.create = function (slug, options) {
  if (!slug || !this.config.dialogs[slug]) {
    return;
  }

  var dialog = this.config.dialogs[slug];
  return this.createDialog(dialog, options);
};

Factory.prototype.render = function (region, slug, options) {
  if (!region) {
    return;
  }

  var dialog = this.create(slug, options);

  if (!dialog) {
    return false;
  }

  region.show(dialog);

  return dialog;
};
<|endoftext|>


<commit_before>var d2l = {

	jasmine: {

		matchers: {

			toHaveCssSelector: function() {
				return {
					compare: function( doc, expected ) {

						if ( !doc ) {
							return { pass: false, message: 'The actual document is not defined.' };
						}

						if ( !expected ) {
							return { pass: false, message: 'The expected value is not defined.' };
						}

						for ( var i=0; i<doc.styleSheets.length; ++i ) {
							for ( var j=0; j<doc.styleSheets[i].cssRules.length; ++j ) {
								var selectors = doc.styleSheets[i].cssRules[j].selectorText.split( ',' );
								for ( var k=0; k<selectors.length; k++ ) {
									if ( selectors[k].replace( /(^\s+|\s+$)/g,'' ) === expected ) {
										return { pass: true };
									}
								}
							}
						}

						return { pass: false, message: 'Expected to find ' + expected + ' css selector but did not.' };

					}
				};
			}

		}

	}

};<commit_msg>Refactoring matchers.<commit_after>var d2l = {

	jasmine: {

		_private: {

			compareStyle: function( node, property, expected ) {

				if ( !node ) {
					return { pass: false, message: 'The node value is not defined.' };
				}
				if ( !expected ) {
					return { pass: false, message: 'The expected value is not defined.' };
				}

				var val = window.getComputedStyle( node, null ).getPropertyValue( property );
				if ( val === expected ) {
					return { pass: true };
				} else {
					return { pass: false, message: 'Expected to find ' + expected + ' but found ' + val + '.' };
				}

			}

		},

		matchers: {

			toHaveCssSelector: function() {
				return {
					compare: function( doc, expected ) {

						if ( !doc ) {
							return { pass: false, message: 'The document value is not defined.' };
						}
						if ( !expected ) {
							return { pass: false, message: 'The expected value is not defined.' };
						}

						for ( var i=0; i<doc.styleSheets.length; ++i ) {
							for ( var j=0; j<doc.styleSheets[i].cssRules.length; ++j ) {
								var selectors = doc.styleSheets[i].cssRules[j].selectorText.split( ',' );
								for ( var k=0; k<selectors.length; k++ ) {
									if ( selectors[k].replace( /(^\s+|\s+$)/g,'' ) === expected ) {
										return { pass: true };
									}
								}
							}
						}

						return { pass: false, message: 'Expected to find ' + expected + ' css selector but did not.' };

					}
				};
			},

			toHaveFontWeight: function() {
				return {
					compare: function( node, expected ) {
						return d2l.jasmine._private.compareStyle(
								node, 'font-weight', expected
							);
					}
				};
			},

			toHaveRgbColor: function() {
				return {
					compare: function( node, expected ) {
						return d2l.jasmine._private.compareStyle(
								node, 'color', expected
							);
					}
				};
			},

			toHaveTextDecoration: function() {
				return {
					compare: function( node, expected ) {
						return d2l.jasmine._private.compareStyle(
								node, 'text-decoration', expected
							);
					}
				};
			}

		}

	}

};<|endoftext|>


<commit_before>////////////////////////////////////////////////
/*   Provided Code - Please Don't Edit   */
////////////////////////////////////////////////
'use strict';

function getInput() {
    console.log("Please choose either 'rock', 'paper', or 'scissors'.")
    return prompt();
}
function randomPlay() {
    var randomNumber = Math.random();
    if (randomNumber < 0.33) {
        return "rock";
    } else if (randomNumber < 0.66) {
        return "paper";
    } else {
        return "scissors";
    }
}
////////////////////////////////////////////////
/*           Write Your Code Below            */
////////////////////////////////////////////////

function getPlayerMove(move) {
    // Write an expression that operates on a variable called `move`
    var move;
    // If a `move` has a value, your expression should evaluate to that value.
    if (move != null){
    	var expression = move;
    } else {
    	var expression = getInput();
    }
    // However, if `move` is not specified / is null, your expression should equal `getInput()`.
    return expression;
}

function getComputerMove(move) {
    // Write an expression that operates on a variable called `move`
    // If a `move` has a value, your expression should evaluate to that value.
    // However, if `move` is not specified / is null, your expression should equal `randomPlay()`.
    return /* Your Expression */;
}

function getWinner(playerMove,computerMove) {
    var winner;
    // Write code that will set winner to either 'player', 'computer', or 'tie' based on the values of playerMove and computerMove.
    // Assume that the only values playerMove and computerMove can have are 'rock', 'paper', and 'scissors'.
    // The rules of the game are that 'rock' beats 'scissors', 'scissors' beats 'paper', and 'paper' beats 'rock'.
    /* YOUR CODE HERE */
    return winner;
}

function playToFive() {
    console.log("Let's play Rock, Paper, Scissors");
    var playerWins = 0;
    var computerWins = 0;
    // Write code that plays 'Rock, Paper, Scissors' until either the player or the computer has won five times.
    /* YOUR CODE HERE */
    return [playerWins, computerWins];
}

<commit_msg>got the comps move donezo as well<commit_after>////////////////////////////////////////////////
/*   Provided Code - Please Don't Edit   */
////////////////////////////////////////////////
'use strict';

function getInput() {
    console.log("Please choose either 'rock', 'paper', or 'scissors'.")
    return prompt();
}
function randomPlay() {
    var randomNumber = Math.random();
    if (randomNumber < 0.33) {
        return "rock";
    } else if (randomNumber < 0.66) {
        return "paper";
    } else {
        return "scissors";
    }
}
////////////////////////////////////////////////
/*           Write Your Code Below            */
////////////////////////////////////////////////

function getPlayerMove(move) {
    // Write an expression that operates on a variable called `move`
    var move;
    // If a `move` has a value, your expression should evaluate to that value.
    if (move != null){
    	var userMove = move;
    } else {
    	var userMove = getInput();
    }
    // However, if `move` is not specified / is null, your expression should equal `getInput()`.
    return userMove;
}

function getComputerMove(move) {
    // Write an expression that operates on a variable called `move`
    var move;
    // If a `move` has a value, your expression should evaluate to that value.
    if (move != null){
    	var compsMove = move;
    } else {
    	var compsMove = randomPlay();
    }
    // However, if `move` is not specified / is null, your expression should equal `randomPlay()`.
    return compsMove;
}

function getWinner(playerMove,computerMove) {
    var winner;
    // Write code that will set winner to either 'player', 'computer', or 'tie' based on the values of playerMove and computerMove.
    // Assume that the only values playerMove and computerMove can have are 'rock', 'paper', and 'scissors'.
    // The rules of the game are that 'rock' beats 'scissors', 'scissors' beats 'paper', and 'paper' beats 'rock'.
    /* YOUR CODE HERE */
    return winner;
}

function playToFive() {
    console.log("Let's play Rock, Paper, Scissors");
    var playerWins = 0;
    var computerWins = 0;
    // Write code that plays 'Rock, Paper, Scissors' until either the player or the computer has won five times.
    /* YOUR CODE HERE */
    return [playerWins, computerWins];
}

<|endoftext|>


<commit_before>import path from 'path';
import buildPackage from './build-package';
import {getAllPackagePaths} from './utils/package';

// Run buildPackage on all of our packages
console.log(new Date());
getAllPackagePaths().map((pkg) => {
  try {
    const pkgName = require(path.resolve(pkg, `package.json`)).name.split(`/`).pop();
    return buildPackage(pkgName, pkg);
  }
  catch (err) {
    throw err;
  }
});
console.log(new Date());
<commit_msg>chore(tooling): Remove extraneous console.log<commit_after>import path from 'path';
import buildPackage from './build-package';
import {getAllPackagePaths} from './utils/package';

// Run buildPackage on all of our packages
getAllPackagePaths().map((pkg) => {
  try {
    const pkgName = require(path.resolve(pkg, `package.json`)).name.split(`/`).pop();
    return buildPackage(pkgName, pkg);
  }
  catch (err) {
    throw err;
  }
});
<|endoftext|>


<commit_before>// Copyright 2002-2014, University of Colorado Boulder

/**
 * A rectangular push button that draws gradients and such in order to create
 * a somewhat 2D effect.
 *
 * @author John Blanco
 */
define( function( require ) {
  'use strict';

  // Includes
  var AbstractButton = require( 'SUN/experimental/buttons/AbstractButton' );
  var Color = require( 'SCENERY/util/Color' );
  var inherit = require( 'PHET_CORE/inherit' );
  var LinearGradient = require( 'SCENERY/util/LinearGradient' );
  var Node = require( 'SCENERY/nodes/Node' );
  var Rectangle = require( 'SCENERY/nodes/Rectangle' );
  var Shape = require( 'KITE/Shape' );
  var Vector2 = require( 'DOT/Vector2' );

  // Constants
  var HIGHLIGHT_GRADIENT_LENGTH = 7; // In screen coords, which are roughly pixels.
  var SHADE_GRADIENT_LENGTH = 3; // In screen coords, which are roughly pixels.

  /**
   * @param {Node} content - Node to put on surface of button, could be text, icon, or whatever
   * @param {Object} options
   * @constructor
   */
  function RectangularPushButton( content, options ) {

    var thisButton = this;
    AbstractButton.call( thisButton, { listener: options.listener, fireOnDown: options.fireOnDown } );

    options = _.extend( {
      // Default values.
      cursor: 'pointer',
      cornerRounding: 4,
      baseColor: new Color( 153, 206, 255 ),
      disabledBaseColor: new Color( 220, 220, 220 ),
      xPadding: 5,
      yPadding: 5,
      listener: null,
      fireOnDown: false,
      touchExpansionX: 5,
      touchExpansionY: 5
    }, options );

    var buttonWidth = content.width + options.xPadding * 2;
    var buttonHeight = content.height + options.yPadding * 2;
    var upCenter = new Vector2( buttonWidth / 2, buttonHeight / 2 );
    var downCenter = upCenter.plus( new Vector2( 0.5, 0.5 ) ); // Displacement empirically determined.
    var verticalHighlightStop = HIGHLIGHT_GRADIENT_LENGTH / buttonHeight;
    var verticalShadowStop = 1 - SHADE_GRADIENT_LENGTH / buttonHeight;
    var horizontalHighlightStop = HIGHLIGHT_GRADIENT_LENGTH / buttonWidth;
    var horizontalShadowStop = 1 - SHADE_GRADIENT_LENGTH / buttonWidth;
    var baseColor = options.baseColor;
    var disabledBaseColor = options.disabledBaseColor;
    var transparentBaseColor = new Color( baseColor.getRed(), baseColor.getGreen(), baseColor.getBlue(), 0 );
    var transparentDisabledBaseColor = new Color( disabledBaseColor.getRed(), disabledBaseColor.getGreen(), disabledBaseColor.getBlue(), 0 );

    // Create the gradient fills used for various button states
    var upFillVertical = new LinearGradient( 0, 0, 0, buttonHeight )
      .addColorStop( 0, baseColor.colorUtilsBrighter( 0.7 ) )
      .addColorStop( verticalHighlightStop, baseColor )
      .addColorStop( verticalShadowStop, baseColor )
      .addColorStop( 1, baseColor.colorUtilsDarker( 0.5 ) );

    var upFillHorizontal = new LinearGradient( 0, 0, buttonWidth, 0 )
      .addColorStop( 0, baseColor.colorUtilsBrighter( 0.7 ) )
      .addColorStop( horizontalHighlightStop, transparentBaseColor )
      .addColorStop( horizontalShadowStop, transparentBaseColor )
      .addColorStop( 1, baseColor.colorUtilsDarker( 0.5 ) );

    var overFillVertical = new LinearGradient( 0, 0, 0, buttonHeight )
      .addColorStop( 0, baseColor.colorUtilsBrighter( 0.7 ) )
      .addColorStop( verticalHighlightStop, baseColor.colorUtilsBrighter( 0.5 ) )
      .addColorStop( verticalShadowStop, baseColor.colorUtilsBrighter( 0.5 ) )
      .addColorStop( 1, baseColor.colorUtilsDarker( 0.5 ) );

    var overFillHorizontal = new LinearGradient( 0, 0, buttonWidth, 0 )
      .addColorStop( 0, baseColor.colorUtilsBrighter( 0.7 ) )
      .addColorStop( horizontalHighlightStop, transparentBaseColor )
      .addColorStop( horizontalShadowStop, transparentBaseColor )
      .addColorStop( 1, baseColor.colorUtilsDarker( 0.5 ) );

    var downFill = new LinearGradient( 0, 0, 0, buttonHeight )
      .addColorStop( 0, baseColor.colorUtilsBrighter( 0.7 ) )
      .addColorStop( verticalHighlightStop * 0.67, baseColor.colorUtilsDarker( 0.3 ) )
      .addColorStop( verticalShadowStop, baseColor.colorUtilsBrighter( 0.2 ) )
      .addColorStop( 1, baseColor.colorUtilsDarker( 0.5 ) );

    var disabledFillVertical = new LinearGradient( 0, 0, 0, buttonHeight )
      .addColorStop( 0, disabledBaseColor.colorUtilsBrighter( 0.7 ) )
      .addColorStop( verticalHighlightStop, disabledBaseColor.colorUtilsBrighter( 0.5 ) )
      .addColorStop( verticalShadowStop, disabledBaseColor.colorUtilsBrighter( 0.5 ) )
      .addColorStop( 1, disabledBaseColor.colorUtilsDarker( 0.5 ) );

    var disabledFillHorizontal = new LinearGradient( 0, 0, buttonWidth, 0 )
      .addColorStop( 0, disabledBaseColor.colorUtilsBrighter( 0.7 ) )
      .addColorStop( horizontalHighlightStop, transparentDisabledBaseColor )
      .addColorStop( horizontalShadowStop, transparentDisabledBaseColor )
      .addColorStop( 1, disabledBaseColor.colorUtilsDarker( 0.5 ) );

    // Create the basic button shape.
    var background = new Rectangle( 0, 0, buttonWidth, buttonHeight, options.cornerRounding, options.cornerRounding,
      {
        fill: options.baseColor
      } );
    this.addChild( background );

    // Create the overlay that is used to add horizontal shading.
    var overlayForHorizGradient = new Rectangle( 0, 0, buttonWidth, buttonHeight, options.cornerRounding, options.cornerRounding,
      {
        fill: options.baseColor
      } );
    this.addChild( overlayForHorizGradient );

    content.center = upCenter;
    thisButton.addChild( content );

    // Hook up the function that will modify button appearance as the state changes.
    this.buttonModel.interactionState.link( function( interactionState ) {

      switch( interactionState ) {

        case 'idle':
          background.fill = upFillVertical;
          overlayForHorizGradient.fill = upFillHorizontal;
          content.center = upCenter;
          thisButton.pickable = true;
          break;

        case 'over':
          content.center = upCenter;
          background.fill = overFillVertical;
          overlayForHorizGradient.fill = overFillHorizontal;
          thisButton.pickable = true;
          break;

        case 'pressed':
          content.center = downCenter;
          background.fill = downFill;
          overlayForHorizGradient.fill = overFillHorizontal;
          thisButton.pickable = true;
          break;

        case 'disabled':
          content.center = upCenter;
          background.fill = disabledFillVertical;
          overlayForHorizGradient.fill = disabledFillHorizontal;
          thisButton.pickable = false;
          break;
      }
    } );

    // Add explicit mouse and touch areas so that the child nodes can all be non-pickable.
    this.mouseArea = Shape.rectangle( 0, 0, buttonWidth, buttonHeight );
    this.touchArea = Shape.rectangle( -options.touchExpansionX, -options.touchExpansionY, buttonWidth + options.touchExpansionX * 2, buttonHeight + options.touchExpansionY * 2 );

    // Mutate with the options after the layout is complete so that
    // width-dependent fields like centerX will work.
    thisButton.mutate( options );
  }

  return inherit( AbstractButton, RectangularPushButton );
} );<commit_msg>Made the icons become transparent when the button is disabled.<commit_after>// Copyright 2002-2014, University of Colorado Boulder

/**
 * A rectangular push button that draws gradients and such in order to create
 * a somewhat 2D effect.
 *
 * @author John Blanco
 */
define( function( require ) {
  'use strict';

  // Includes
  var AbstractButton = require( 'SUN/experimental/buttons/AbstractButton' );
  var Color = require( 'SCENERY/util/Color' );
  var inherit = require( 'PHET_CORE/inherit' );
  var LinearGradient = require( 'SCENERY/util/LinearGradient' );
  var Node = require( 'SCENERY/nodes/Node' );
  var Rectangle = require( 'SCENERY/nodes/Rectangle' );
  var Shape = require( 'KITE/Shape' );
  var Vector2 = require( 'DOT/Vector2' );

  // Constants
  var HIGHLIGHT_GRADIENT_LENGTH = 7; // In screen coords, which are roughly pixels.
  var SHADE_GRADIENT_LENGTH = 3; // In screen coords, which are roughly pixels.

  /**
   * @param {Node} content - Node to put on surface of button, could be text, icon, or whatever
   * @param {Object} options
   * @constructor
   */
  function RectangularPushButton( content, options ) {

    var thisButton = this;
    AbstractButton.call( thisButton, { listener: options.listener, fireOnDown: options.fireOnDown } );

    options = _.extend( {
      // Default values.
      cursor: 'pointer',
      cornerRounding: 4,
      baseColor: new Color( 153, 206, 255 ),
      disabledBaseColor: new Color( 220, 220, 220 ),
      xPadding: 5,
      yPadding: 5,
      listener: null,
      fireOnDown: false,
      touchExpansionX: 5,
      touchExpansionY: 5
    }, options );

    var buttonWidth = content.width + options.xPadding * 2;
    var buttonHeight = content.height + options.yPadding * 2;
    var upCenter = new Vector2( buttonWidth / 2, buttonHeight / 2 );
    var downCenter = upCenter.plus( new Vector2( 0.5, 0.5 ) ); // Displacement empirically determined.
    var verticalHighlightStop = HIGHLIGHT_GRADIENT_LENGTH / buttonHeight;
    var verticalShadowStop = 1 - SHADE_GRADIENT_LENGTH / buttonHeight;
    var horizontalHighlightStop = HIGHLIGHT_GRADIENT_LENGTH / buttonWidth;
    var horizontalShadowStop = 1 - SHADE_GRADIENT_LENGTH / buttonWidth;
    var baseColor = options.baseColor;
    var disabledBaseColor = options.disabledBaseColor;
    var transparentBaseColor = new Color( baseColor.getRed(), baseColor.getGreen(), baseColor.getBlue(), 0 );
    var transparentDisabledBaseColor = new Color( disabledBaseColor.getRed(), disabledBaseColor.getGreen(), disabledBaseColor.getBlue(), 0 );

    // Create the gradient fills used for various button states
    var upFillVertical = new LinearGradient( 0, 0, 0, buttonHeight )
      .addColorStop( 0, baseColor.colorUtilsBrighter( 0.7 ) )
      .addColorStop( verticalHighlightStop, baseColor )
      .addColorStop( verticalShadowStop, baseColor )
      .addColorStop( 1, baseColor.colorUtilsDarker( 0.5 ) );

    var upFillHorizontal = new LinearGradient( 0, 0, buttonWidth, 0 )
      .addColorStop( 0, baseColor.colorUtilsBrighter( 0.7 ) )
      .addColorStop( horizontalHighlightStop, transparentBaseColor )
      .addColorStop( horizontalShadowStop, transparentBaseColor )
      .addColorStop( 1, baseColor.colorUtilsDarker( 0.5 ) );

    var overFillVertical = new LinearGradient( 0, 0, 0, buttonHeight )
      .addColorStop( 0, baseColor.colorUtilsBrighter( 0.7 ) )
      .addColorStop( verticalHighlightStop, baseColor.colorUtilsBrighter( 0.5 ) )
      .addColorStop( verticalShadowStop, baseColor.colorUtilsBrighter( 0.5 ) )
      .addColorStop( 1, baseColor.colorUtilsDarker( 0.5 ) );

    var overFillHorizontal = new LinearGradient( 0, 0, buttonWidth, 0 )
      .addColorStop( 0, baseColor.colorUtilsBrighter( 0.7 ) )
      .addColorStop( horizontalHighlightStop, transparentBaseColor )
      .addColorStop( horizontalShadowStop, transparentBaseColor )
      .addColorStop( 1, baseColor.colorUtilsDarker( 0.5 ) );

    var downFill = new LinearGradient( 0, 0, 0, buttonHeight )
      .addColorStop( 0, baseColor.colorUtilsBrighter( 0.7 ) )
      .addColorStop( verticalHighlightStop * 0.67, baseColor.colorUtilsDarker( 0.3 ) )
      .addColorStop( verticalShadowStop, baseColor.colorUtilsBrighter( 0.2 ) )
      .addColorStop( 1, baseColor.colorUtilsDarker( 0.5 ) );

    var disabledFillVertical = new LinearGradient( 0, 0, 0, buttonHeight )
      .addColorStop( 0, disabledBaseColor.colorUtilsBrighter( 0.7 ) )
      .addColorStop( verticalHighlightStop, disabledBaseColor.colorUtilsBrighter( 0.5 ) )
      .addColorStop( verticalShadowStop, disabledBaseColor.colorUtilsBrighter( 0.5 ) )
      .addColorStop( 1, disabledBaseColor.colorUtilsDarker( 0.5 ) );

    var disabledFillHorizontal = new LinearGradient( 0, 0, buttonWidth, 0 )
      .addColorStop( 0, disabledBaseColor.colorUtilsBrighter( 0.7 ) )
      .addColorStop( horizontalHighlightStop, transparentDisabledBaseColor )
      .addColorStop( horizontalShadowStop, transparentDisabledBaseColor )
      .addColorStop( 1, disabledBaseColor.colorUtilsDarker( 0.5 ) );

    // Create the basic button shape.
    var background = new Rectangle( 0, 0, buttonWidth, buttonHeight, options.cornerRounding, options.cornerRounding,
      {
        fill: options.baseColor
      } );
    this.addChild( background );

    // Create the overlay that is used to add horizontal shading.
    var overlayForHorizGradient = new Rectangle( 0, 0, buttonWidth, buttonHeight, options.cornerRounding, options.cornerRounding,
      {
        fill: options.baseColor
      } );
    this.addChild( overlayForHorizGradient );

    content.center = upCenter;
    thisButton.addChild( content );

    // Hook up the function that will modify button appearance as the state changes.
    this.buttonModel.interactionState.link( function( interactionState ) {

      switch( interactionState ) {

        case 'idle':
          content.center = upCenter;
          content.opacity = 1;
          background.fill = upFillVertical;
          overlayForHorizGradient.fill = upFillHorizontal;
          thisButton.pickable = true;
          break;

        case 'over':
          content.center = upCenter;
          content.opacity = 1;
          background.fill = overFillVertical;
          overlayForHorizGradient.fill = overFillHorizontal;
          thisButton.pickable = true;
          break;

        case 'pressed':
          content.center = downCenter;
          content.opacity = 1;
          background.fill = downFill;
          overlayForHorizGradient.fill = overFillHorizontal;
          thisButton.pickable = true;
          break;

        case 'disabled':
          content.center = upCenter;
          content.opacity = 0.3;
          background.fill = disabledFillVertical;
          overlayForHorizGradient.fill = disabledFillHorizontal;
          thisButton.pickable = false;
          break;
      }
    } );

    // Add explicit mouse and touch areas so that the child nodes can all be non-pickable.
    this.mouseArea = Shape.rectangle( 0, 0, buttonWidth, buttonHeight );
    this.touchArea = Shape.rectangle( -options.touchExpansionX, -options.touchExpansionY, buttonWidth + options.touchExpansionX * 2, buttonHeight + options.touchExpansionY * 2 );

    // Mutate with the options after the layout is complete so that
    // width-dependent fields like centerX will work.
    thisButton.mutate( options );
  }

  return inherit( AbstractButton, RectangularPushButton );
} );<|endoftext|>


<commit_before>(function () {
    'use strict';

    angular
        .module('dpSearchResults')
        .constant('SEARCH_CONFIG', {
            QUERY_ENDPOINTS: [
                {
                    // The slug variable is used to indentify this category in list.component.js
                    slug: 'openbareruimte',
                    label_singular: 'Openbare ruimte',
                    label_plural: 'Openbare ruimtes',
                    uri: 'atlas/search/openbareruimte/'
                }, {
                    // The slug variable is used to indentify this category in list.component.js
                    slug: 'adres',
                    label_singular: 'Adres',
                    label_plural: 'Adressen',
                    uri: 'atlas/search/adres/'
                }, {
                    slug: 'vestiging',
                    label_singular: 'Vestiging',
                    label_plural: 'Vestigingen',
                    uri: 'handelsregister/search/vestiging/'
                }, {
                    slug: 'mac',
                    label_singular: 'Maatschappelijke activiteit',
                    label_plural: 'Maatschappelijke activiteiten',
                    uri: 'handelsregister/search/maatschappelijkeactiviteit/'
                }, {
                    slug: 'object',
                    label_singular: 'Kadastraal object',
                    label_plural: 'Kadastrale objecten',
                    uri: 'atlas/search/kadastraalobject/'
                }, {
                    slug: 'subject',
                    label_singular: 'Kadastraal subject',
                    label_plural: 'Kadastrale subjecten',
                    uri: 'atlas/search/kadastraalsubject/'
                }, {
                    // The slug variable is used to indentify this category in list.component.js
                    slug: 'gebied',
                    label_singular: 'Gebied',
                    label_plural: 'Gebieden',
                    uri: 'atlas/search/gebied/',
                    subtypes: {
                        grootstedelijk: 'grootstedelijk gebied',
                        gebiedsgerichtwerken: 'gebiedsgericht werken'
                    }
                }, {
                    slug: 'meetbout',
                    label_singular: 'Meetbout',
                    label_plural: 'Meetbouten',
                    uri: 'meetbouten/search/'
                }
            ],
            COORDINATES_ENDPOINTS: [
                {
                    uri: 'geosearch/nap/',
                    radius: 25
                }, {
                    uri: 'geosearch/atlas/',
                    radius: null
                }, {
                    uri: 'geosearch/search/?item=verdachtgebied',
                    radius: 0
                }, {
                    uri: 'geosearch/search/?item=bominslag',
                    radius: 25
                }, {
                    uri: 'geosearch/search/?item=uitgevoerdonderzoek',
                    radius: 0
                }, {
                    uri: 'geosearch/search/?item=gevrijwaardgebied',
                    radius: 0
                }
            ],
            COORDINATES_HIERARCHY: [
                {
                    // The slug variable is used to indentify this category in list.component.js
                    slug: 'openbareruimte',
                    label_singular: 'Openbare ruimte',
                    label_plural: 'Openbare ruimtes',
                    features: ['bag/openbareruimte']
                }, {
                    // The slug variable is used to indentify this category in geosearch.factory.js
                    slug: 'pand',
                    label_singular: 'Pand',
                    label_plural: 'Panden',
                    features: ['bag/pand']
                }, {
                    // The slug variable is used to indentify this category in geosearch.factory.js
                    slug: 'standplaats',
                    label_singular: 'Standplaats',
                    label_plural: 'Standplaatsen',
                    features: ['bag/standplaats']
                }, {
                    // The slug variable is used to indentify this category in geosearch.factory.js
                    slug: 'ligplaats',
                    label_singular: 'Ligplaats',
                    label_plural: 'Ligplaatsen',
                    features: ['bag/ligplaats']
                }, {
                    label_singular: 'Kadastraal object',
                    label_plural: 'Kadastrale objecten',
                    features: ['kadaster/kadastraal_object']
                }, {
                    label_singular: 'Gemeentelijke beperking',
                    label_plural: 'Gemeentelijke beperkingen',
                    features: ['wkpb/beperking']
                }, {
                    // The slug variable is used to indentify this category in list.component.js
                    slug: 'gebied',
                    label_singular: 'Gebied',
                    label_plural: 'Gebieden',
                    features: [
                        'gebieden/grootstedelijkgebied',
                        'gebieden/unesco',
                        'gebieden/stadsdeel',
                        'gebieden/gebiedsgerichtwerken',
                        'gebieden/buurtcombinatie',
                        'gebieden/buurt',
                        'gebieden/bouwblok'
                    ],
                    subtypes: {
                        grootstedelijkgebied: 'grootstedelijk gebied',
                        gebiedsgerichtwerken: 'gebiedsgericht werken'
                    }
                }, {
                    label_singular: 'Meetbout',
                    label_plural: 'Meetbouten',
                    features: ['meetbouten/meetbout']
                }, {
                    label_singular: 'NAP Peilmerk',
                    label_plural: 'NAP Peilmerken',
                    features: ['nap/peilmerk']
                }, {
                    label_singular: 'Explosief',
                    label_plural: 'Explosieven',
                    features: [
                        'geosearch/search/?item=verdachtgebied',
                        'geosearch/search/?item=bominslag',
                        'geosearch/search/?item=uitgevoerdonderzoek',
                        'geosearch/search/?item=gevrijwaardgebied'
                    ]
                }
            ]
        });
})();
<commit_msg>Bommen geosearch endpoints config.<commit_after>(function () {
    'use strict';

    angular
        .module('dpSearchResults')
        .constant('SEARCH_CONFIG', {
            QUERY_ENDPOINTS: [
                {
                    // The slug variable is used to indentify this category in list.component.js
                    slug: 'openbareruimte',
                    label_singular: 'Openbare ruimte',
                    label_plural: 'Openbare ruimtes',
                    uri: 'atlas/search/openbareruimte/'
                }, {
                    // The slug variable is used to indentify this category in list.component.js
                    slug: 'adres',
                    label_singular: 'Adres',
                    label_plural: 'Adressen',
                    uri: 'atlas/search/adres/'
                }, {
                    slug: 'vestiging',
                    label_singular: 'Vestiging',
                    label_plural: 'Vestigingen',
                    uri: 'handelsregister/search/vestiging/'
                }, {
                    slug: 'mac',
                    label_singular: 'Maatschappelijke activiteit',
                    label_plural: 'Maatschappelijke activiteiten',
                    uri: 'handelsregister/search/maatschappelijkeactiviteit/'
                }, {
                    slug: 'object',
                    label_singular: 'Kadastraal object',
                    label_plural: 'Kadastrale objecten',
                    uri: 'atlas/search/kadastraalobject/'
                }, {
                    slug: 'subject',
                    label_singular: 'Kadastraal subject',
                    label_plural: 'Kadastrale subjecten',
                    uri: 'atlas/search/kadastraalsubject/'
                }, {
                    // The slug variable is used to indentify this category in list.component.js
                    slug: 'gebied',
                    label_singular: 'Gebied',
                    label_plural: 'Gebieden',
                    uri: 'atlas/search/gebied/',
                    subtypes: {
                        grootstedelijk: 'grootstedelijk gebied',
                        gebiedsgerichtwerken: 'gebiedsgericht werken'
                    }
                }, {
                    slug: 'meetbout',
                    label_singular: 'Meetbout',
                    label_plural: 'Meetbouten',
                    uri: 'meetbouten/search/'
                }
            ],
            COORDINATES_ENDPOINTS: [
                {
                    uri: 'geosearch/nap/',
                    radius: 25
                }, {
                    uri: 'geosearch/atlas/',
                    radius: null
                }, {
                    uri: 'geosearch/munitie/',
                    radius: null
                }, {
                    uri: 'geosearch/bominslag/',
                    radius: 25
                }
            ],
            COORDINATES_HIERARCHY: [
                {
                    // The slug variable is used to indentify this category in list.component.js
                    slug: 'openbareruimte',
                    label_singular: 'Openbare ruimte',
                    label_plural: 'Openbare ruimtes',
                    features: ['bag/openbareruimte']
                }, {
                    // The slug variable is used to indentify this category in geosearch.factory.js
                    slug: 'pand',
                    label_singular: 'Pand',
                    label_plural: 'Panden',
                    features: ['bag/pand']
                }, {
                    // The slug variable is used to indentify this category in geosearch.factory.js
                    slug: 'standplaats',
                    label_singular: 'Standplaats',
                    label_plural: 'Standplaatsen',
                    features: ['bag/standplaats']
                }, {
                    // The slug variable is used to indentify this category in geosearch.factory.js
                    slug: 'ligplaats',
                    label_singular: 'Ligplaats',
                    label_plural: 'Ligplaatsen',
                    features: ['bag/ligplaats']
                }, {
                    label_singular: 'Kadastraal object',
                    label_plural: 'Kadastrale objecten',
                    features: ['kadaster/kadastraal_object']
                }, {
                    label_singular: 'Gemeentelijke beperking',
                    label_plural: 'Gemeentelijke beperkingen',
                    features: ['wkpb/beperking']
                }, {
                    // The slug variable is used to indentify this category in list.component.js
                    slug: 'gebied',
                    label_singular: 'Gebied',
                    label_plural: 'Gebieden',
                    features: [
                        'gebieden/grootstedelijkgebied',
                        'gebieden/unesco',
                        'gebieden/stadsdeel',
                        'gebieden/gebiedsgerichtwerken',
                        'gebieden/buurtcombinatie',
                        'gebieden/buurt',
                        'gebieden/bouwblok'
                    ],
                    subtypes: {
                        grootstedelijkgebied: 'grootstedelijk gebied',
                        gebiedsgerichtwerken: 'gebiedsgericht werken'
                    }
                }, {
                    label_singular: 'Meetbout',
                    label_plural: 'Meetbouten',
                    features: ['meetbouten/meetbout']
                }, {
                    label_singular: 'NAP Peilmerk',
                    label_plural: 'NAP Peilmerken',
                    features: ['nap/peilmerk']
                }, {
                    label_singular: 'Explosief',
                    label_plural: 'Explosieven',
                    features: [
                        'bommenkaart/verdachtgebied',
                        'bommenkaart/bominslag',
                        'bommenkaart/uitgevoerdonderzoek',
                        'bommenkaart/gevrijwaardgebied'
                    ]
                }
            ]
        });
})();
<|endoftext|>