<commit_before>/* jquery.findyourcandidate.ca
 * =====================
 *
 * Extends and overrides the jQuery.findYourRep plugin built by <NAME> to
 * render a find-your-reps form into a target HTML element using the Open North
 * Represent API.
 *
 * Copyright 2014 Open North Inc. BSD3 License.
 *
 * Usage:
 * ------
 *
 * Create an HTML element to use as a target, and call findYourRep(options) on it.
 * This example shows the default options.
 *
 * ```javascript
 * $('.mytarget').findYourRep({
 *   apis: 'represent',
 *   title: 'The Title of your Widget',
 *   text: 'Enter your address to see who represents you.',
 *   action: 'Go!'
 * });
 * ```
 */
;(function(window){

$.findYourRep.represent = function(address) {
  var dfd = new $.Deferred(),
      url = "https://represent.opennorth.ca/candidates/?limit=0&callback=?",
      params = {};

  $.findYourRep.geocodeOrResolveImmediately(address).done(function(geocoded){
    params.point = geocoded.latitude + ',' + geocoded.longitude;
    $.findYourRep.apiCall(url, params).done(function(data){
      dfd.resolve(data['objects']);
    });
  });
  return dfd;
};

$.findYourRep.getTemplateContext = function(rep, api){
  return {
    details: rep.elected_office + ', ' + rep.district_name,
    photoUrl: rep.photo_url,
    resultUrl: rep.url || rep.source_url,
    name: rep.name,
    distric_name: rep.distric_name,
    elected_office: rep.elected_office,
    source_url: rep.source_url,
    party_name: rep.party_name,
    email: rep.email,
    url: rep.url
  };
}

$.findYourRep.formTemplate = "" +
  "<div class='find-your-rep fyr-container' id='fyr{{ idx }}' data-apis='{{ apis }}'>" +
    "<h3>{{ title }}</h3>" +
    "<p>{{ text }}</p>" +
    "<div class='fyr-controls'>" +
      "<textarea placeholder='Enter your address'>{{ defaultValue }}</textarea>" +
      "<button class='fyr-submit'>{{ action }}</button>" +
      "</div>" +
      "<small>Powered by <a href='https://represent.opennorth.ca/'>Represent</a></small>" +
  "</div>";

$.findYourRep.resultsTemplate = "" +
"<div class='fyr-results'>" +
  "<h3>Your Representatives</h3>" +
  "<div class='fyr-represent cf' style='display:none;'>" +
    "<ul class='fyr-reps'></ul>" +
  "</div>" +
  "<a href='#' class='fyr-back'>&laquo; start over</a>" +
  "<small>Powered by <a href='https://represent.opennorth.ca/'>Represent</a></small>" +
"</div>";

})(this);<commit_msg>Update results template. Override result template.<commit_after>/* jquery.findyourcandidate.ca
 * =====================
 *
 * Extends and overrides the jQuery.findYourRep plugin built by <NAME> to
 * render a find-your-reps form into a target HTML element using the Open North
 * Represent API.
 *
 * Copyright 2014 Open North Inc. BSD3 License.
 *
 * Usage:
 * ------
 *
 * Create an HTML element to use as a target, and call findYourRep(options) on it.
 * This example shows the default options.
 *
 * ```javascript
 * $('.mytarget').findYourRep({
 *   apis: 'represent',
 *   title: 'The Title of your Widget',
 *   text: 'Enter your address to see who represents you.',
 *   action: 'Go!'
 * });
 * ```
 */
;(function(window){

$.findYourRep.represent = function(address) {
  var dfd = new $.Deferred(),
      url = "https://represent.opennorth.ca/candidates/?limit=0&callback=?",
      params = {};

  $.findYourRep.geocodeOrResolveImmediately(address).done(function(geocoded){
    params.point = geocoded.latitude + ',' + geocoded.longitude;
    $.findYourRep.apiCall(url, params).done(function(data){
      dfd.resolve(data['objects']);
    });
  });
  return dfd;
};

$.findYourRep.getTemplateContext = function(rep, api){
  return {
    details: rep.elected_office + ' for ' + rep.district_name,
    photoUrl: rep.photo_url,
    resultUrl: rep.url || rep.source_url,
    name: rep.name,
    distric_name: rep.distric_name,
    elected_office: rep.elected_office,
    source_url: rep.source_url,
    party_name: rep.party_name,
    email: rep.email,
    url: rep.url
  };
}

$.findYourRep.formTemplate = "" +
  "<div class='find-your-rep fyr-container' id='fyr{{ idx }}' data-apis='{{ apis }}'>" +
    "<h3>{{ title }}</h3>" +
    "<p>{{ text }}</p>" +
    "<div class='fyr-controls'>" +
      "<textarea placeholder='Enter your address'>{{ defaultValue }}</textarea>" +
      "<button class='fyr-submit'>{{ action }}</button>" +
      "</div>" +
      "<small>Powered by <a href='https://represent.opennorth.ca/'>Represent</a></small>" +
  "</div>";

$.findYourRep.resultsTemplate = "" +
"<div class='fyr-results'>" +
  "<h3>Your Candidates</h3>" +
  "<div class='fyr-represent cf' style='display:none;'>" +
    "<ul class='fyr-reps'></ul>" +
  "</div>" +
  "<a href='#' class='fyr-back'>&laquo; start over</a>" +
  "<small>Powered by <a href='https://represent.opennorth.ca/'>Represent</a></small>" +
"</div>";

$.findYourRep.resultTemplate = "" +
  "<li class='fyr-rep cf'>" +
    "<a href='{{ resultUrl }}' target='_top'>" +
    "<img src='{{ photoUrl }}' alt='photo of'>" +
    "<h4>{{ name }}</h4>" +
    "<p class='fyr-details'>{{ party_name }} {{ details }}</p>" +
    "</a>" +
  "</li>";

})(this);
{'fraction_non_alphanumeric': 0.20602621796126003, 'fraction_numerical': 0.00430444140090002, 'mean_word_length': 3.630434782608696, 'pattern_counts': {'":': 0, '<': 74, '<?xml version=': 0, '>': 74, 'https://': 6, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6944473', 'n_tokens_mistral': 1788, 'n_tokens_neox': 1749, 'n_words': 380}