mirror of
https://github.com/DarrenOfficial/dpaste.git
synced 2024-12-23 23:23:06 +11:00
Better checkbox click handling though this really needs a refactor.
This commit is contained in:
parent
e844f343e4
commit
0f5e1b1c62
1 changed files with 9 additions and 10 deletions
|
@ -37,7 +37,7 @@
|
|||
<a onclick="return confirm('{% trans "Really delete this snippet?" %}')" href="{% url snippet_delete snippet.secret_id %}">Delete now!</a>
|
||||
—
|
||||
{% endif %}
|
||||
<a id="toggleWordwrap" href="#"><input type="checkbox"/> {% trans "Wordwrap" %}</a>
|
||||
<span id="toggleWordwrap"><input type="checkbox"/> <a href="#">{% trans "Wordwrap" %}</a></span>
|
||||
</div>
|
||||
<h2>
|
||||
{% if snippet.title %}{{ snippet.title }}{% else %} {% trans "Snippet" %} #{{ snippet.id}}{% endif %}
|
||||
|
@ -129,18 +129,17 @@ jQuery(document).ready(function(){
|
|||
/**
|
||||
* Wordwrap
|
||||
*/
|
||||
$('#toggleWordwrap').toggle(
|
||||
function(){
|
||||
$('input', this).attr('checked', 'checked');
|
||||
$('#toggleWordwrap a').click(function(){
|
||||
$('#toggleWordwrap input').trigger('click').trigger('change');
|
||||
});
|
||||
|
||||
$('#toggleWordwrap input').change(function(){
|
||||
if($(this).attr('checked')) {
|
||||
$('div.snippet pre.code').css('white-space', 'pre-wrap');
|
||||
return false;
|
||||
},
|
||||
function(){
|
||||
$('input', this).attr('checked', '');
|
||||
} else {
|
||||
$('div.snippet pre.code').css('white-space', 'pre');
|
||||
return false;
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
// Activate wordwrap for text heavy lexers or if enabled in the settings
|
||||
if('{{ wordwrap }}' === 'True' || '{{ request.session.userprefs.wordwrap }}' === 'True') {
|
||||
|
|
Loading…
Reference in a new issue