Adding preference to turn off highlighter.

This commit is contained in:
Samuel Clay 2020-07-14 17:30:35 -04:00
parent a6a6d51983
commit 009a59006e
3 changed files with 26 additions and 1 deletions

View file

@ -28,6 +28,7 @@ _.extend(NEWSBLUR.ReaderPreferences.prototype, {
this.original_preferences = this.serialize_preferences();
this.$modal.bind('click', $.rescope(this.handle_click, this));
this.$modal.bind('click', $.rescope(this.handle_click, this));
},
make_modal: function() {
@ -795,6 +796,21 @@ _.extend(NEWSBLUR.ReaderPreferences.prototype, {
$.make('div', { className: 'NB-preference-label'}, [
'Story button placement'
])
]),
$.make('div', { className: 'NB-preference NB-preference-highlights' }, [
$.make('div', { className: 'NB-preference-options' }, [
$.make('div', [
$.make('input', { id: 'NB-preference-highlights-1', type: 'radio', name: 'highlights', value: 'true' }),
$.make('label', { 'for': 'NB-preference-highlights-1' }, 'Show highlighter when selecting text')
]),
$.make('div', [
$.make('input', { id: 'NB-preference-highlights-2', type: 'radio', name: 'highlights', value: 'false' }),
$.make('label', { 'for': 'NB-preference-highlights-2' }, 'Disable the highlighter')
])
]),
$.make('div', { className: 'NB-preference-label'}, [
'Enable highlighting'
])
])
]),
$.make('div', { className: 'NB-tab NB-tab-keyboard' }, [
@ -1130,6 +1146,12 @@ _.extend(NEWSBLUR.ReaderPreferences.prototype, {
return false;
}
});
$('input[name=highlights]', $modal).each(function() {
if ($(this).val() == ""+NEWSBLUR.Preferences.highlights) {
$(this).attr('checked', true);
return false;
}
});
$('input[name=keyboard_verticalarrows]', $modal).each(function() {
if ($(this).val() == NEWSBLUR.Preferences.keyboard_verticalarrows) {
$(this).attr('checked', true);

View file

@ -725,6 +725,8 @@ NEWSBLUR.Views.StoryDetailView = Backbone.View.extend({
return;
}
if (!NEWSBLUR.assets.preference('highlights')) return;
this.$(".NB-starred-story-selection-highlight,[data-tippy]").contents().unwrap();
$doc.attr('id', 'NB-highlighting');

View file

@ -93,7 +93,8 @@
'story_share_readitlater' : false,
'story_share_instapaper' : true,
'story_share_email' : true,
'theme' : 'auto'
'theme' : 'auto',
'highlights' : true
};
NEWSBLUR.URLs = {
'upload-avatar' : "{% url "upload-avatar" %}",