Skip to content

Instantly share code, notes, and snippets.

@Simon-L
Last active August 29, 2015 14:14
Show Gist options
  • Save Simon-L/f35d641a417358dbfb90 to your computer and use it in GitHub Desktop.
Save Simon-L/f35d641a417358dbfb90 to your computer and use it in GitHub Desktop.
Adding tagging on save in Wallabag and its Chrome extension the *very* hackish way!
function displayView($view, $id = 0)
...
case 'save':
$tpl_vars = array();
if (isset($_GET['url'])){
$tpl_vars['url'] = $_GET['url'];
}
if (isset($_GET['encoded_url'])){
$tpl_vars['encoded_url'] = $_GET['encoded_url'];
}
break;
...
# In Chrome extension
- var if_url = base_url + '?action=add&url=' + btoa(url);
+ var if_url = base_url + '?view=save&url=' + url + '&encoded_url=' + btoa(url);
{% block content %}
<script src="{{ poche_url }}themes/_global/js/jquery-ui-1.10.4.custom.min.js"></script>
<script src="{{ poche_url }}themes/_global/js/autoCompleteTags.js"></script>
<link rel="stylesheet" href="{{ poche_url }}themes/_global/css/jquery-ui-1.10.4.custom.min.css" media="all">
<form method="get" action="./" target="_blank" id="bagit-form-form">
<h2>{% trans "Save a link" %}</h2>
<input type="hidden" name="action" value="add"/>
<input type="hidden" name="url" value="{{encoded_url}}"/>
<label for="value">{% trans "Url:" %}</label>
<input disabled value="{{url}}"/>
<br><br>
<label for="value">{% trans "Add tags:" %}</label>
<input type="text" placeholder="{% trans "interview" %}, {% trans "editorial" %}, {% trans "video" %}" id="tags" name="tags" />
<p>{% trans "Start typing for auto complete." %}<br>
{% trans "You can enter multiple tags, separated by commas." %}</p>
<input type="submit" value="{% trans "save link!" %}" />
</form>
{% endblock %}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment