Skip to content

Commit

Permalink
Merge PR #71: Version 1.6.0
Browse files Browse the repository at this point in the history
Version 1.6.0
  • Loading branch information
jungshadow authored Nov 7, 2016
2 parents 933bfe8 + d2346e9 commit 4c59d23
Show file tree
Hide file tree
Showing 16 changed files with 292 additions and 117 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "yfpp2016",
"version": "1.5.0",
"version": "1.6.0",
"description": "A foul-mouthed election information application",
"main": "index.js",
"scripts": {
Expand All @@ -19,7 +19,7 @@
"browser-sync": "2.9.11",
"browserify": "11.2.0",
"connect-history-api-fallback": "1.1.0",
"gulp": "3.9.0",
"gulp": "^3.9.1",
"gulp-autoprefixer": "3.1.0",
"gulp-notify": "2.2.0",
"gulp-rename": "1.2.2",
Expand Down
Binary file added src/images/finger.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
74 changes: 57 additions & 17 deletions src/scripts/components/Actions.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
// Import dependencies
// Import dependencies
import React from 'react';
import ReactDOM from 'react-dom';

import helpers from '../helpers';
import $ from 'jquery';

import analytics from '../analytics'

/**
* Load social media
*/
Expand Down Expand Up @@ -43,12 +45,58 @@ window.twttr = (function(d, s, id) {
return window.twttr || (t = { _e: [], ready: function(f) { t._e.push(f); } });
}(document, "script", "twitter-wjs"));

window.twttr.ready(function(twttr){ //Wrap on twttr.ready for async compatibility.
/*
Twitter Tracking
Create Twitter events for clicks, tweets, RTs, Follows and Favorites.
Uses an iterator to avoid repetitive code.
Adapted from https://github.com/bluestatedigital/bsd-google-analytics-integration
and written by Yahel Carmon https://github.com/yahelc
Released under an Apache 2.0 License http://www.apache.org/licenses/
*/
/*
getElem: This is a shortcut function for parsing a URL using the DOM.
This allows you to quickly get the domain, pathname, etc off of a full URL.
From https://github.com/bluestatedigital/bsd-google-analytics-integration
*/

function getElem(href) {
var target = document.createElement("a");
target.href = href;
return target;
}
'click tweet retweet follow favorite'.replace(/\w+/g, function(n) {
twttr.events.bind(n, function(intent) {
var target;
if (intent && intent.target) {
if (intent.target.src) {
target = getElem(decodeURIComponent((intent.target.src.match(/[&#?](url=)([^&]*)/)||[""]).pop()));
}
else if (intent && intent.target && intent.target.href) {
$.each(decodeURIComponent(intent.target.search).replace(/\+/g, " ").split(/&| |\=/g), function(i, v) {
if (v.match(/(^https?:\/\/)|(^www.)/)) {
target = getElem(v);
return false;
}
});
}
}
if(target){
analytics.social_action("twitter", intent.type, target.href.replace(target.hash, ""), target.pathname);
}
});
});
});


$(function(){
$('#app').on('click', '.shareLocationFacebook', function(event) {
event.preventDefault();

function facebook_callback(response) {
analytics.social_action("facebook", "post", undefined)
}

var obj = {
method: 'feed',
link: 'http://yourfuckingpollingplace.com/?utm_source=facebook&utm_medium=social&utm_campaign=YFPP_2016_USER_' + $(this).data('state'),
Expand All @@ -57,7 +105,7 @@ $(function(){
caption: "YourFuckingPollingPlace.com",
description: 'I vote at ' + $(this).data('name') + ' in ' + $(this).data('city') + ' ' + $(this).data('state') + ', where the fuck do you vote? Visit YourFuckingPollingPlace.com to find out.'
};
FB.ui(obj);
FB.ui(obj, facebook_callback);

});
});
Expand Down Expand Up @@ -108,13 +156,9 @@ $(function(){
// if locationName exists setup text string including location name
// else use predefined string
if (location.locationName) {

text = encodeURI('I vote at ' + helpers.titlecase(helpers.fucktify(location.locationName)) + ' where the fuck do you vote? Find out at');

text = encodeURI('I vote at ' + helpers.titlecase(helpers.fucktify(location.locationName)) + '. Where the fuck do you vote? Find out at');
} else {

text = 'I found my fucking polling location, where the fuck do you vote? Find out at';

text = 'I found my fucking polling location. Where the fuck do you vote? Find out at';
}

const related = authorTwitter.join(',');
Expand Down Expand Up @@ -145,7 +189,6 @@ $(function(){
* @method buildMap
*/
buildMap() {

// sets props.location to local variable
const location = this.props.location;

Expand All @@ -154,14 +197,12 @@ $(function(){

// if locationName exists, make that shit title cased
if (location.locationName) {

casedLocationName = helpers.titlecase(location.locationName)

}

// set up url components to build google maps url
const components = [
casedLocationName,
//casedLocationName,
location.line1,
location.line2 || '',
location.city,
Expand All @@ -172,7 +213,6 @@ $(function(){
// build google maps url from components array
const url = "https://maps.google.com/maps?q=" + encodeURI(components.join(' '))


return <a className="actionLink actionLink_map" href={url} target="_blank">Map</a>
}

Expand Down Expand Up @@ -206,9 +246,9 @@ $(function(){
</div>
</li>
</ul>
)
}
)
}

};
};

export default Actions;
export default Actions;
Loading

0 comments on commit 4c59d23

Please sign in to comment.