cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dblot...@apache.org
Subject [3/3] docs commit: Improved maintainability of copy buttons on main page. This closes #321.
Date Sat, 29 Aug 2015 01:08:47 GMT
Improved maintainability of copy buttons on main page. This closes #321.


Project: http://git-wip-us.apache.org/repos/asf/cordova-docs/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-docs/commit/cebafcc9
Tree: http://git-wip-us.apache.org/repos/asf/cordova-docs/tree/cebafcc9
Diff: http://git-wip-us.apache.org/repos/asf/cordova-docs/diff/cebafcc9

Branch: refs/heads/cordova-website
Commit: cebafcc95c1729489b58631af99a4ab318eb2e78
Parents: 67fd0bf
Author: riknoll <riknoll@microsoft.com>
Authored: Fri Aug 28 11:52:26 2015 -0700
Committer: Dmitry Blotsky <dmitry.blotsky@gmail.com>
Committed: Fri Aug 28 18:08:27 2015 -0700

----------------------------------------------------------------------
 www/index.html                   | 13 ++++++++-----
 www/static/css-src/_home.scss    |  5 +++++
 www/static/css-src/_plugins.scss |  5 -----
 www/static/js/index.js           | 13 +++----------
 4 files changed, 16 insertions(+), 20 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/cebafcc9/www/index.html
----------------------------------------------------------------------
diff --git a/www/index.html b/www/index.html
index 148d4a3..e6d2e4f 100644
--- a/www/index.html
+++ b/www/index.html
@@ -80,9 +80,10 @@ permalink: /
         <div class="col-md-4">
             <div class="well_code">
                 <div>
-                    <button id="copy-npm-install" type="button" class="btn btn btn-primary
pull-right">Copy</button>
+                    <button type="button" class="btn btn btn-primary pull-right btn-copy"
data-clipboard-target="copy-npm-install-text">Copy</button>
                 </div>
                 $ npm install -g cordova
+                <div id="copy-npm-install-text" class="copy-text">npm install -g cordova</div>
             </div>
         </div>
     </div>
@@ -98,9 +99,10 @@ permalink: /
         <div class="col-md-4">
             <div class="well_code">
                 <div>
-                    <button id="copy-cordova-create" type="button" class="btn btn btn-primary
pull-right">Copy</button>
+                    <button type="button" class="btn btn btn-primary pull-right btn-copy"
data-clipboard-target="copy-cordova-create-text">Copy</button>
                 </div>
                 $ cordova create MyApp
+                <div id="copy-cordova-create-text" class="copy-text">cordova create
MyApp</div>
             </div>
         </div>
     </div>
@@ -117,10 +119,11 @@ permalink: /
         <div class="col-md-4">
             <div class="well_code">
                 <div>
-                    <button id="copy-cordova-platform-add" type="button" class="btn btn
btn-primary pull-right">Copy</button>
+                    <button type="button" class="btn btn btn-primary pull-right btn-copy"
data-clipboard-target="copy-cordova-platform-add-text">Copy</button>
                 </div>
                 <p>$ cd MyApp</p>
                 <p>$ cordova platform add browser</p>
+                <div id="copy-cordova-platform-add-text" class="copy-text">cd MyApp&#10;cordova
platform add browser</div>
             </div>
         </div>
     </div>
@@ -136,9 +139,10 @@ permalink: /
         <div class="col-md-4">
             <div class="well_code">
                 <div>
-                    <button id="copy-cordova-run" type="button" class="btn btn btn-primary
pull-right">Copy</button>
+                    <button type="button" class="btn btn btn-primary pull-right btn-copy"
data-clipboard-target="copy-cordova-run-text">Copy</button>
                 </div>
                 $ cordova run browser
+                <div id="copy-cordova-run-text" class="copy-text">cordova run browser</div>
             </div>
         </div>
     </div>
@@ -201,4 +205,3 @@ permalink: /
     {% include tools_and_samples.html %}
 
 </div><!-- /container-fluid -->
-

http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/cebafcc9/www/static/css-src/_home.scss
----------------------------------------------------------------------
diff --git a/www/static/css-src/_home.scss b/www/static/css-src/_home.scss
index 52984de..25af288 100644
--- a/www/static/css-src/_home.scss
+++ b/www/static/css-src/_home.scss
@@ -186,6 +186,11 @@ img#logo_top {
 			margin:5px;
 		}
 	}
+	.copy-text {
+		width:0px;
+		height:0px;
+		overflow:hidden;
+	}
 }
 
 

http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/cebafcc9/www/static/css-src/_plugins.scss
----------------------------------------------------------------------
diff --git a/www/static/css-src/_plugins.scss b/www/static/css-src/_plugins.scss
index 71f7920..f2ef372 100644
--- a/www/static/css-src/_plugins.scss
+++ b/www/static/css-src/_plugins.scss
@@ -115,11 +115,6 @@
 	margin-bottom:20px;
 	background-color:$gray-5;
 	position: relative;
-	.plugin-cordova-command {
-		width:0px;
-		height:0px;
-		overflow:hidden;
-	}
 }
 .version_and_author {
 	display: inline-block;

http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/cebafcc9/www/static/js/index.js
----------------------------------------------------------------------
diff --git a/www/static/js/index.js b/www/static/js/index.js
index 6816410..b2c18c2 100644
--- a/www/static/js/index.js
+++ b/www/static/js/index.js
@@ -109,17 +109,10 @@ $(document).ready(function () {
         document.getElementById("new_blog_count").innerHTML = new_blog_count;
     }
 
-    // code for copy text
-    var addCopyText = function(elementId, copyText) {
-        new ZeroClipboard(document.getElementById(elementId))
-            .on("copy", function(event) {
-                event.clipboardData.setData("text/plain", copyText);
-            });
+    var copyButtons = document.getElementsByClassName("btn-copy");
+    for(var i = 0; i < copyButtons.length; i++) {
+        new ZeroClipboard(copyButtons[i]);
     }
-    addCopyText("copy-npm-install", "npm install -g cordova");
-    addCopyText("copy-cordova-create", "cordova create MyApp");
-    addCopyText("copy-cordova-platform-add", "cd MyApp\ncordova platform add browser");
-    addCopyText("copy-cordova-run", "cordova run browser");
 
     // Smooth scroll to anchor links
     $("a[href^='#']").on('click', function(e) {


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org


Mime
View raw message