Navigation Menu

Skip to content
This repository has been archived by the owner on May 12, 2019. It is now read-only.

Commit

Permalink
Improve twitter share link based in a url native helper.
Browse files Browse the repository at this point in the history
- Fixed little bug in javascript code order
- Removed residual file from gulpfile
  • Loading branch information
Kikobeats committed Aug 15, 2015
1 parent 4aaa2ed commit 6328b03
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 18 deletions.
1 change: 1 addition & 0 deletions assets/js/src/__init.coffee
@@ -1,6 +1,7 @@
'use strict'

$ ->

window.Uno = Uno =
version: '2.3.3'

Expand Down
1 change: 1 addition & 0 deletions assets/js/src/cover.coffee
@@ -1,6 +1,7 @@
'use strict'

$ ->

el = document.body
isOpen = location.hash is '#open'

Expand Down
21 changes: 8 additions & 13 deletions assets/js/src/main.coffee
@@ -1,29 +1,24 @@
'use strict'

$ ->
el = document.body

if Uno.is 'device', 'desktop'
$(document.links).filter ->
@hostname != window.location.hostname
.attr 'target', '_blank'

el.dataset.page ?= Uno.context()
el.dataset.device ?= Uno.device()
el = document.body
el.dataset.page = Uno.context()
el.dataset.device = Uno.device()
$(window).on "resize", Uno.device()
$(window).on "orientationchange", Uno.device()

Uno.readTime()
FastClick.attach el unless Uno.is 'device', 'desktop'

if Uno.is 'device', 'desktop'
$(document.links).filter ->
@hostname != window.location.hostname
.attr 'target', '_blank'

if Uno.is 'page', 'post'
$('main').readingTime readingTimeTarget: '.post.reading-time > span'
$('.content').fitVids()
postTitle = $('#post-title').text()
postTitle = postTitle.substring(0, postTitle.length - 1); # delete dot
shareLink = "http://twitter.com/share?url=" + encodeURIComponent(document.URL)
shareLink += "&text=" + encodeURIComponent "#{postTitle} »"
$('#share_twitter').attr('href', shareLink)

if Uno.is 'page', 'error'
$('#panic-button').click ->
Expand Down
1 change: 1 addition & 0 deletions assets/js/src/search.coffee
@@ -1,6 +1,7 @@
'use strict'

$ ->

showSearch = ->
$(".content").hide()
$('#search-results').addClass('active')
Expand Down
4 changes: 2 additions & 2 deletions assets/js/uno.js 100755 → 100644

Large diffs are not rendered by default.

3 changes: 1 addition & 2 deletions gulpfile.coffee
Expand Up @@ -32,8 +32,7 @@ src =
main : ['assets/js/src/__init.coffee'
'assets/js/src/main.coffee'
'assets/js/src/cover.coffee'
'assets/js/src/search.coffee'
'assets/js/src/post.coffee']
'assets/js/src/search.coffee']
vendor : ['assets/vendor/fastclick/lib/fastclick.js'
'assets/vendor/ghostHunter/jquery.ghostHunter.min.js'
'assets/vendor/pace/pace.min.js'
Expand Down
2 changes: 1 addition & 1 deletion post.hbs
Expand Up @@ -13,7 +13,7 @@
<span class="post reading-time"> – <span></span> read.</span>
</div>

<a id="share_twitter" alt="Tweet '{{title}}'" target="_blank">
<a alt="Tweet '{{title}}'" href="https://twitter.com/intent/tweet?text={{encode title}} {{encode ' » '}}&amp;url={{url absolute="true"}}" >
{{#if image}}<img id="post-image" src={{image}} alt="{{{title}}}">{{/if}}
<h1 class="icon-reverse icon-social-twitter-post" id="post-title">{{{title}}}.</h1>
</a>
Expand Down

0 comments on commit 6328b03

Please sign in to comment.