[MediaWiki-commits] [Gerrit] wikipedia...ProveIt[master]: Add method citation.remove()

2017-03-30 Thread Sophivorus (Code Review)
Sophivorus has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/345713 )

Change subject: Add method citation.remove()
..


Add method citation.remove()

Change-Id: I904c8724d4913e75762650a8d5b90d806ea2d126
---
M proveit.js
1 file changed, 12 insertions(+), 5 deletions(-)

Approvals:
  Sophivorus: Verified; Looks good to me, approved



diff --git a/proveit.js b/proveit.js
index 7930272..4c03730 100755
--- a/proveit.js
+++ b/proveit.js
@@ -453,6 +453,16 @@
};
 
/**
+* Remove this citation from the textbox
+*/
+   this.remove = function () {
+   var textbox = proveit.getTextbox(),
+   text = textbox.val();
+   text = text.replace( this.string, '' );
+   textbox.val( text );
+   };
+
+   /**
 * Highlight this citation in the textbox and scroll it to view
 *
 * @return {void}
@@ -574,15 +584,12 @@
var textbox = proveit.getTextbox(),
text = textbox.val();
text = text.replace( reference.string, '' );
+   textbox.val( text );
 
// Remove all the citations
-   // @todo citation.remove()
reference.citations.forEach( function ( 
citation ) {
-   text = text.replace( citation.string, 
'' );
+   citation.remove();
});
-
-   // Update the textbox
-   textbox.val( text );
 
// Add the tag and summary
proveit.addTag();

-- 
To view, visit https://gerrit.wikimedia.org/r/345713
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I904c8724d4913e75762650a8d5b90d806ea2d126
Gerrit-PatchSet: 1
Gerrit-Project: wikipedia/gadgets/ProveIt
Gerrit-Branch: master
Gerrit-Owner: Sophivorus 
Gerrit-Reviewer: Sophivorus 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] wikipedia...ProveIt[master]: Add method citation.remove()

2017-03-30 Thread Sophivorus (Code Review)
Sophivorus has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/345713 )

Change subject: Add method citation.remove()
..

Add method citation.remove()

Change-Id: I904c8724d4913e75762650a8d5b90d806ea2d126
---
M proveit.js
1 file changed, 12 insertions(+), 5 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikipedia/gadgets/ProveIt 
refs/changes/13/345713/1

diff --git a/proveit.js b/proveit.js
index 7930272..4c03730 100755
--- a/proveit.js
+++ b/proveit.js
@@ -453,6 +453,16 @@
};
 
/**
+* Remove this citation from the textbox
+*/
+   this.remove = function () {
+   var textbox = proveit.getTextbox(),
+   text = textbox.val();
+   text = text.replace( this.string, '' );
+   textbox.val( text );
+   };
+
+   /**
 * Highlight this citation in the textbox and scroll it to view
 *
 * @return {void}
@@ -574,15 +584,12 @@
var textbox = proveit.getTextbox(),
text = textbox.val();
text = text.replace( reference.string, '' );
+   textbox.val( text );
 
// Remove all the citations
-   // @todo citation.remove()
reference.citations.forEach( function ( 
citation ) {
-   text = text.replace( citation.string, 
'' );
+   citation.remove();
});
-
-   // Update the textbox
-   textbox.val( text );
 
// Add the tag and summary
proveit.addTag();

-- 
To view, visit https://gerrit.wikimedia.org/r/345713
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I904c8724d4913e75762650a8d5b90d806ea2d126
Gerrit-PatchSet: 1
Gerrit-Project: wikipedia/gadgets/ProveIt
Gerrit-Branch: master
Gerrit-Owner: Sophivorus 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits