Discussion:
[PATCH 1/2] javascript tweak: simplify show_content()
Jason Woofenden
2011-04-16 22:47:33 UTC
Permalink
---
modern.js | 3 +--
1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/modern.js b/modern.js
index 0e88e0c..9acad27 100644
--- a/modern.js
+++ b/modern.js
@@ -8,8 +8,7 @@ $(function() {
}

function show_content(name) {
- $("#content")
- .children("h2[id='" + name + "']")
+ $('#' + name)
.show()
.next("div")
.show();
--
1.7.4.4
Jason Woofenden
2011-04-16 22:47:34 UTC
Permalink
This adds a "share this page" link to the bottom of the home page. With
javascript enabled, the link makes a new section appear at the bottom, with
links to share on many popular sites. Without javascript (so everything is on
one page) the "share this page" link scrolls you down to the bottom where the
share links are.

No icons were used. This is easy, fast, and there's no potential licensing or
trademark issues.
---
index.html | 14 ++++++++++++++
modern.js | 9 +++++++++
2 files changed, 23 insertions(+), 0 deletions(-)

diff --git a/index.html b/index.html
index 954444f..1b8d290 100644
--- a/index.html
+++ b/index.html
@@ -30,6 +30,7 @@
<div class="chapter">
cmus is a small, <em>fast</em> and powerful console music player for Unix-like operating systems.
<img class="screenshot" alt="cmus screenshot" title="cmus' tree view" src="cmus-2.3.0.png" />
+ <p><a class="share-button" href="#share">Share This Page</a></p>
</div>

<h2 id="features">Features</h2>
@@ -163,6 +164,19 @@ make install</code></pre>
<li><a href="http://mikmod.raphnet.net/">libmikmod</a> (.mod, .s3m, ...)</li>
</ul>
</div>
+ <h2 id="share">Share This Page On:</h2>
+ <div class="chapter">
+ <ul>
+ <li><a href="http://identi.ca/index.php?action=newnotice&amp;status_textarea=C%2a%20Music%20Player%3a%20http%3A%2F%2Fcmus.sourceforge.net%2F">Identi.ca</a></li>
+ <li><a href="http://del.icio.us/post?url=http%3A%2F%2Fcmus.sourceforge.net%2F&amp;title=C%2a%20Music%20Player">Delicious</a></li>
+ <li><a href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fcmus.sourceforge.net%2F&amp;title=C%2a%20Music%20Player">Digg</a></li>
+ <li><a href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fcmus.sourceforge.net%2F&amp;title=C%2a%20Music%20Player">StubleUpon</a></li>
+ <li><a href="http://www.google.com/bookmarks/mark?op=add&amp;bkmk=http%3A%2F%2Fcmus.sourceforge.net%2F&amp;title=C%2a%20Music%20Player">Google</a></li>
+ <li><a href="http://myweb2.search.yahoo.com/myresults/bookmarklet?u=http%3A%2F%2Fcmus.sourceforge.net%2F&amp;t=C%2a%20Music%20Player">Yahoo</a></li>
+ <li><a href="http://twitter.com/home?status=http%3A%2F%2Fcmus.sourceforge.net%2F">Twitter</a></li>
+ <li><a href="http://www.facebook.com/sharer.php?u=http%3A%2F%2Fcmus.sourceforge.net%2F&amp;t=C%2a%20Music%20Player">Facebook</a></li>
+ </ol>
+ </div>
</div>

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
diff --git a/modern.js b/modern.js
index 9acad27..0735b44 100644
--- a/modern.js
+++ b/modern.js
@@ -41,5 +41,14 @@ $(function() {
show_only(href.substring(1));
});

+ $('.share-button')
+ .attr('href', 'javascript:void(0)')
+ .click(function(e) {
+ e.preventDefault();
+
+ show_content('share');
+ });
+
+
show_only(location_id());
});
--
1.7.4.4
Jason Woofenden
2011-04-16 23:02:03 UTC
Permalink
These are of course patches against www.git not cmus.git.

Any kind of changes or suggestions are welcome. I like having
Identi.ca first, but other than that, and not having
facebook/twitter/etc branding visible by default, I'm not terribly
particular about how this works or looks.

Any sites I missed that should be added?

I just copied the share links from here:

http://www.nysenate.gov/district/44

and then added Indenti.ca.


Take care, - Jason
Gregory Petrosyan
2011-04-17 06:38:41 UTC
Permalink
Post by Jason Woofenden
This adds a "share this page" link to the bottom of the home page. With
javascript enabled, the link makes a new section appear at the bottom, with
links to share on many popular sites. Without javascript (so everything is on
one page) the "share this page" link scrolls you down to the bottom where the
share links are.
No icons were used. This is easy, fast, and there's no potential licensing or
trademark issues.
Thanks a lot — very good! I've merged both (slightly modified the
second one, though).

                Gregory
Jason Woofenden
2011-04-17 08:18:06 UTC
Permalink
Post by Gregory Petrosyan
Thanks a lot — very good! I've merged both (slightly modified the
second one, though).
Ahh, that looks much better. Thank you!

Take care, - Jason

Loading...