Commit cee75a7a authored by Malcolm Blaney's avatar Malcolm Blaney

Update reader module, indie-action now uses data for checked state

rather than class. Revert indieConfig change in core.pub.js, should not have added actionSet check in handleConfig.
parent 3706f815
Pipeline #17392985 passed with stage
in 1 minute 10 seconds
......@@ -3,7 +3,7 @@
// @licstart The following is the entire license notice
// for the JavaScript code in this page.
//
// Copyright (C) 2017 Malcolm Blaney
// Copyright (C) 2018 Malcolm Blaney
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
......@@ -97,4 +97,4 @@ if($(".reader-discovered").dialog("isOpen")){$(".reader-discovered").dialog("clo
if(reader.content){$(".reader-content").html(reader.content);}
if(reader.more){$(".reader-more").show();}
else{$(".reader-more").hide();}
$(".reader-settings").html(reader.settings);feedSettings();newFeedEvents();if(dobrado.localStorage){localStorage.reader=reader.content;localStorage.readerUpdate=new Date().getTime();localStorage.readerPage=location.href;}});};dobrado.reader.update=function(action){request("newer",action);};dobrado.reader.scrollback=function(url,cancelled){if($('.reader-item a[href="'+url+'"]').length!==0){$('.reader-item a[href="'+url+'"]').get(0).scrollIntoView();if(!cancelled){var item=$('.reader-item a[href="'+url+'"]').parents('.reader-item');item.find('indie-action').removeClass('checked');dobrado.indieConfig();}}};}());
\ No newline at end of file
$(".reader-settings").html(reader.settings);feedSettings();newFeedEvents();if(dobrado.localStorage){localStorage.reader=reader.content;localStorage.readerUpdate=new Date().getTime();localStorage.readerPage=location.href;}});};dobrado.reader.update=function(action){request("newer",action);};dobrado.reader.scrollback=function(url,cancelled){if($('.reader-item a[href="'+url+'"]').length!==0){$('.reader-item a[href="'+url+'"]').get(0).scrollIntoView();if(!cancelled){var item=$('.reader-item a[href="'+url+'"]').parents('.reader-item');item.find('indie-action').data('checked',false);dobrado.indieConfig();}}};}());
\ No newline at end of file
......@@ -534,11 +534,11 @@ if (!this.dobrado.reader) {
if ($('.reader-item a[href="'+url+'"]').length !== 0) {
$('.reader-item a[href="'+url+'"]').get(0).scrollIntoView();
if (!cancelled) {
// Remove the checked class on the indie-actions for this item so
// Set checked to false on the indie-action's for this item so
// that indieConfig will add a highlight to the actioned link and
// also update the href to point to the new permalink.
var item = $('.reader-item a[href="'+url+'"]').parents('.reader-item');
item.find('indie-action').removeClass('checked');
item.find('indie-action').data('checked', false);
dobrado.indieConfig();
}
}
......
......@@ -50,7 +50,7 @@ else{xhr=null;}
return xhr;}
function updateActions(state){$('indie-action').each(function(){var action=$(this).attr('do');var target=$(this).attr('with')||window.location.href;if(state[target]&&state[target][action]){$(this).children('a').attr('href',state[target][action]).addClass('highlight');if(action==='follow'){var text=$(this).children('a').text();text=text.replace(/^follow\s/,'following ');$(this).children('a').text(text);}
$(this).siblings('.indie-config-info').hide();}});}
var config=JSON.parse(localStorage.indieConfig);if(!config||!actionSet(config)){return;}
var config=JSON.parse(localStorage.indieConfig);if(!config){return;}
var statusQuery={};var targetList={};$('indie-action').each(function(){if($(this).data('checked')){return true;}
var action=$(this).attr('do');var href=hrefConfig(action,config);var status='';var url='';var target=$(this).attr('with')||window.location.href;if(href!==''&&($('.reader').length===0||$('#writer-content').length===0)){href=href.replace('{url}',encodeURIComponent(target));$(this).children('a').attr('href',href);$(this).css('display','inline');$(this).siblings('.indie-config-info').hide();}
else{$(this).data('checked',true);}
......
......@@ -192,7 +192,7 @@ if (!this.dobrado) {
// handleConfig is only called if localStorage is available.
var config = JSON.parse(localStorage.indieConfig);
if (!config || !actionSet(config)) {
if (!config) {
return;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment