소스 검색

Add share buttons for Diaspora and Mastodon on the homepage

Julien Deswaef 7 년 전
부모
커밋
c06d35b1b4

+ 27 - 1
src/doc/_includes/stripe-social.html

@@ -2,11 +2,37 @@
   <div class="container">
     <ul class="list-inline">
       <li>
-        <iframe class="github-btn" src="https://ghbtns.com/github-btn.html?user=ForkAwesome&repo=Fork-Awesome&type=watch&count=true" allowtransparency="true" frameborder="0" scrolling="0" width="100px" height="20px"></iframe>
+        <input name="popup" id="overlay" class="overlay" type="radio">
+        <span class="share">
+          <label class="share-btn btn btn-xs diaspora" title="Share this page on Diaspora*" for="diaspora-share">
+            <i class="fa fa-diaspora" aria-hidden="true"></i> Spread
+          </label>
+          <input name="popup" id="diaspora-share" class="hidden" type="radio">
+          <span class="popup">
+            <label for="overlay"></label>
+            <input name="podurl" value="" placeholder="Diaspora URL (joindiaspora.con)" type="text"><button class="share-btn" type="submit"  value="diaspora">OK</button>
+          </span>
+        </span>
+      </li>
+      <li>
+        <input name="popup" id="overlay" class="overlay" type="radio">
+        <span class="share">
+          <label class="share-btn btn btn-xs mastodon" title="Share this page on Mastodon" for="mastodon-share">
+            <i class="fa fa-mastodon" aria-hidden="true"></i> Toot
+          </label>
+          <input name="popup" id="mastodon-share" class="hidden" type="radio">
+          <span class="popup">
+            <label for="overlay"></label>
+            <input name="podurl" value="" placeholder="Mastodon URL (mastodon.social)" type="text"><button class="share-btn" type="submit"  value="mastodon">OK</button>
+          </span>
+        </span>
       </li>
       <li class="tweet-btn hidden-phone">
         <a href="https://twitter.com/share" class="twitter-share-button" data-url="{{ site.forkawesome.url }}" data-text="Fork Awesome, a fork of the iconic font and CSS framework" data-counturl="{{ site.forkawesome.legacy_url }}" data-count="horizontal">Tweet</a>
       </li>
+      <li class="github-btn">
+        <iframe src="https://ghbtns.com/github-btn.html?user=ForkAwesome&repo=Fork-Awesome&type=watch&count=true" allowtransparency="true" frameborder="0" scrolling="0" width="100px" height="20px"></iframe>
+      </li>
     </ul>
   </div>
 </div>

+ 2 - 1
src/doc/_layouts/base.html

@@ -16,6 +16,7 @@
   ================================================== -->
   <link rel="stylesheet" href="{{ page.relative_path }}assets/css/site.css">
   <link rel="stylesheet" href="{{ page.relative_path }}assets/css/pygments.css">
+  <link rel="stylesheet" href="{{ page.relative_path }}assets/css/share.min.css">
   <link rel="stylesheet" href="{{ page.relative_path }}assets/fork-awesome/css/fork-awesome.css">
 
   <!--[if lt IE 9]>
@@ -36,7 +37,7 @@
   <script src="https://ajax.aspnetcdn.com/ajax/jquery.validate/{{ site.jquery_validate.version }}/jquery.validate.min.js"></script>
   <script src="https://maxcdn.bootstrapcdn.com/bootstrap/{{ site.bootstrap.version }}/js/bootstrap.min.js"></script>
   <script src="{{ page.relative_path }}assets/js/site.js"></script>
-  <script src="{{ page.relative_path }}assets/js/search.js"></script>
+  <script src="{{ page.relative_path }}assets/js/share.min.js"></script>
 
   </body>
 </html>

파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 0 - 0
src/doc/assets/css/share.min.css


+ 1 - 0
src/doc/assets/js/share.min.js

@@ -0,0 +1 @@
+"use strict";document.addEventListener("DOMContentLoaded",function(){function e(e){if(e.match(/^https:\/\//i))return e;var t=e.split("/").filter(function(e){return e.indexOf(".")>-1});return"https://"+encodeURIComponent(t)}for(var t=document.querySelector("h1"),n=document.querySelector("head").querySelector("title"),o=document.querySelector('meta[property="og:title"]'),r=null===n?"":n.textContent,i=null===o?"":o.content,l=null===t?"":t.textContent,u=r||i||l,a=encodeURIComponent(window.location.href),c=document.querySelectorAll(".share-btn"),d=[],s=0;s<c.length;s++)d.push(c[s]);for(var p=document.querySelectorAll(".popup input"),f=[],h=0;h<p.length;h++)f.push(p[h]);var m=function(t){var n="podurl"!==t.target.name,o=n?t.target.value:t.target.nextSibling.value,r=n?t.target.previousSibling.value:t.target.value,i=encodeURI(u).replace(/%20/g,"+"),l=e(r);if("diaspora"===o||"friendica"===o||"socialhome"===o)window.open(l+"/bookmarklet?url="+a+"&title="+i);else if("gnusocial"===o)window.open(l+"/notice/new?status_textarea="+i+"&"+a);else if("mastodon"===o)window.open(l+"/share?text="+i+" "+a);else{if("hubzilla"!==o)return;window.open(l+"/rpost?f=&url="+a+"&title="+i)}};d.forEach(function(e){return e.addEventListener("click",m,!1)}),f.forEach(function(e){return e.addEventListener("keypress",function(e){13===e.keyCode&&m(e)})})});

+ 21 - 0
src/doc/assets/less/site/social-buttons.less

@@ -17,3 +17,24 @@ label.error {
   color: @state-danger-text;
   margin-top: 5px;
 }
+
+/* Get those Github and Twitter Buttons to behave */
+.list-inline li iframe {
+  position: relative !important;
+  display: inline;
+  top: 6px;
+}
+
+/* Federation Share buttons */
+
+.share {
+  .btn-xs {
+    line-height: 1.3;
+    padding-left: 6px;
+    padding-right: 6px;
+  }
+  label,
+  label:hover {
+    color: #fff;
+  }
+}

이 변경점에서 너무 많은 파일들이 변경되어 몇몇 파일들은 표시되지 않았습니다.