diff options
| author | Jules Laplace <jules@okfoc.us> | 2015-04-14 16:08:56 -0400 |
|---|---|---|
| committer | Jules Laplace <jules@okfoc.us> | 2015-04-14 16:08:56 -0400 |
| commit | d23a69383e0871e681cf122441c4531980a2b4c2 (patch) | |
| tree | 9f109430c63e2861262cd20bf1bf066c5856b272 /site/public/assets/javascripts/_env.js | |
| parent | 55bba9f4aab51fb05ebeb01987924e1f97226210 (diff) | |
share links
Diffstat (limited to 'site/public/assets/javascripts/_env.js')
| -rw-r--r-- | site/public/assets/javascripts/_env.js | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/site/public/assets/javascripts/_env.js b/site/public/assets/javascripts/_env.js index ac155b3..c34787d 100644 --- a/site/public/assets/javascripts/_env.js +++ b/site/public/assets/javascripts/_env.js @@ -105,6 +105,8 @@ environment.ready = function(){ load_hash(page) }) + Share.init() + $(window).mousedown(function(e){ if (! menu_open) { controls.pause() @@ -492,4 +494,25 @@ function HustleLoader () { init() } +var Share = { + init: function(){ + $(document).on("click", ".fb", Share.facebook) + $(document).on("click", ".tw", Share.twitter) + }, + + facebook: function (e) { + e.preventDefault() + var link = window.location.href + var msg = $(".postname").html() + var url = "https://www.facebook.com/share.php?u=" + encodeURIComponent(link) + "&t=" + encodeURIComponent(msg) + window.open(url, "_blank") + }, + twitter: function (e) { + e.preventDefault() + var link = window.location.href + var msg = $(".postname").html() + var url = "https://twitter.com/home?status=" + encodeURIComponent(msg + " " + link) + window.open(url, "_blank") + }, +}
\ No newline at end of file |
