Skip to content

Commit

Permalink
Updated for Elkarte 1.1.
Browse files Browse the repository at this point in the history
  • Loading branch information
Frenzie committed Sep 15, 2017
1 parent da60906 commit 7ee8ded
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
6 changes: 3 additions & 3 deletions package-info.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
<package-info xmlns="http://www.elkarte.net/site/package-info" xmlns:elk="http://www.elkarte.net/">
<id>Frenzie:quick_quote</id>
<name>Quick Quote</name>
<version>0.2</version>
<version>0.4</version>
<type>addon</type>
<install for="1.0 - 1.0.99">
<install for="1.0 - 1.1.99">
<readme parsebbc="true">readme.txt</readme>
<license type="inline">This ElkArte addon is released under a BSD license</license>
<require-file name="quickQuote.hooks.php" destination="SUBSDIR">Integration hooks</require-file>
Expand All @@ -14,7 +14,7 @@
<hook hook="integrate_load_theme" file="SUBSDIR/quickQuote.hooks.php" function="QQ_integrate_load_theme" />
</install>

<uninstall for="1.0 - 1.0.99">
<uninstall for="1.0 - 1.1.99">
<hook reverse="true" hook="integrate_load_theme" file="SUBSDIR/quickQuote.hooks.php" function="QQ_integrate_load_theme" />
<remove-file name="SUBSDIR/quickQuote.hooks.php" />
<remove-file name="THEMEDIR/scripts/quickQuote.js" />
Expand Down
11 changes: 9 additions & 2 deletions quickQuote.js
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,11 @@ function initializeQuickQuote() {
}
}

function findAncestor (el, cls) {
while ((el = el.parentNode) && el.className.indexOf(cls) < 0);
return el;
}

var quotebuttons = document.querySelectorAll('.quote_button');

for (var i=0; i<quotebuttons.length; i++) {
Expand All @@ -355,9 +360,11 @@ function initializeQuickQuote() {
link.href = '';
link.textContent = (typeof quickQuote !== 'undefined' && typeof quickQuote.txt !== 'undefined') ? quickQuote.txt : 'Quick Quote';

var username = (quotebuttons[i].parentNode.parentNode.parentNode.previousElementSibling.querySelector('.name').textContent).trim();
var postarea = findAncestor(quotebutton, "postarea");

var username = (postarea.previousElementSibling.querySelector('.name').textContent).trim();
var quote_msg = 'msg=' + quotebutton.href.split('?')[1].split(';')[1].split('=')[1];
var time_unix = quotebutton.parentNode.parentNode.parentNode.querySelector('time').getAttribute('data-timestamp');
var time_unix = postarea.querySelector('time').getAttribute('data-timestamp');

link.startTag = '[quote'+(username?' author='+username:'')+((quote_msg&&time_unix)?' link='+quote_msg+' date='+time_unix:'')+']';
link.endTag = '[/quote]';
Expand Down

0 comments on commit 7ee8ded

Please sign in to comment.