customizable scrolling speed

This commit is contained in:
Athou
2013-10-03 10:40:58 +02:00
parent ba3b8df4c9
commit ffef87e249
8 changed files with 35 additions and 1 deletions

View File

@@ -68,4 +68,7 @@ public class UserSettings extends AbstractModel {
@Column(length = Integer.MAX_VALUE) @Column(length = Integer.MAX_VALUE)
private String customCss; private String customCss;
@Column(name = "scroll_speed")
private int scrollSpeed;
} }

View File

@@ -38,5 +38,8 @@ public class Settings implements Serializable {
@ApiProperty(value = "user's custom css for the website") @ApiProperty(value = "user's custom css for the website")
private String customCss; private String customCss;
@ApiProperty(value = "user's preferred scroll speed when navigating between entries")
private int scrollSpeed;
} }

View File

@@ -79,6 +79,7 @@ public class UserREST extends AbstractREST {
s.setTheme(settings.getTheme()); s.setTheme(settings.getTheme());
s.setCustomCss(settings.getCustomCss()); s.setCustomCss(settings.getCustomCss());
s.setLanguage(settings.getLanguage()); s.setLanguage(settings.getLanguage());
s.setScrollSpeed(settings.getScrollSpeed());
} else { } else {
s.setReadingMode(ReadingMode.unread.name()); s.setReadingMode(ReadingMode.unread.name());
s.setReadingOrder(ReadingOrder.desc.name()); s.setReadingOrder(ReadingOrder.desc.name());
@@ -88,6 +89,7 @@ public class UserREST extends AbstractREST {
s.setSocialButtons(true); s.setSocialButtons(true);
s.setScrollMarks(true); s.setScrollMarks(true);
s.setLanguage("en"); s.setLanguage("en");
s.setScrollSpeed(400);
} }
return Response.ok(s).build(); return Response.ok(s).build();
} }
@@ -116,6 +118,7 @@ public class UserREST extends AbstractREST {
s.setCustomCss(settings.getCustomCss()); s.setCustomCss(settings.getCustomCss());
s.setSocialButtons(settings.isSocialButtons()); s.setSocialButtons(settings.isSocialButtons());
s.setLanguage(settings.getLanguage()); s.setLanguage(settings.getLanguage());
s.setScrollSpeed(settings.getScrollSpeed());
userSettingsDAO.saveOrUpdate(s); userSettingsDAO.saveOrUpdate(s);
return Response.ok().build(); return Response.ok().build();

View File

@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.0.xsd">
<changeSet author="athou" id="scroll-speed">
<addColumn tableName="USERSETTINGS">
<column name="scroll_speed" type="BIGINT" />
</addColumn>
</changeSet>
<changeSet author="athou" id="set-default-scroll-speed">
<update tableName="USERSETTINGS">
<column name="scroll_speed" valueNumeric="400" />
</update>
</changeSet>
</databaseChangeLog>

View File

@@ -7,5 +7,6 @@
<include file="changelogs/db.changelog-1.1.xml" /> <include file="changelogs/db.changelog-1.1.xml" />
<include file="changelogs/db.changelog-1.2.xml" /> <include file="changelogs/db.changelog-1.2.xml" />
<include file="changelogs/db.changelog-1.3.xml" /> <include file="changelogs/db.changelog-1.3.xml" />
<include file="changelogs/db.changelog-1.4.xml" />
</databaseChangeLog> </databaseChangeLog>

View File

@@ -67,6 +67,8 @@ settings.general.show_unread=Show feeds and categories with no unread entries
settings.general.social_buttons=Show social sharing buttons settings.general.social_buttons=Show social sharing buttons
settings.general.scroll_marks=In expanded view, scrolling through entries mark them as read settings.general.scroll_marks=In expanded view, scrolling through entries mark them as read
settings.appearance=Appearance settings.appearance=Appearance
settings.scroll_speed=Scrolling speed when navigating between entries (in milliseconds)
settings.scroll_speed.help=set to 0 to disable
settings.theme=Theme settings.theme=Theme
settings.submit_your_theme=Submit your theme settings.submit_your_theme=Submit your theme
settings.custom_css=Custom CSS settings.custom_css=Custom CSS

View File

@@ -785,10 +785,11 @@ module.controller('FeedListCtrl', [
return; return;
} else { } else {
var scrollTop = elemTop - $('#toolbar').outerHeight(); var scrollTop = elemTop - $('#toolbar').outerHeight();
var speed = SettingsService.settings.scrollSpeed;
watch_scrolling = false; watch_scrolling = false;
$('html, body').animate({ $('html, body').animate({
scrollTop : scrollTop scrollTop : scrollTop
}, 400, 'swing', function() { }, speed, 'swing', function() {
watch_scrolling = true; watch_scrolling = true;
}); });
} }

View File

@@ -55,6 +55,11 @@
</div> </div>
</div> </div>
<div class="tab-pane" ng-class="{active: tab == 'css'}"> <div class="tab-pane" ng-class="{active: tab == 'css'}">
<div>
<label>${settings.scroll_speed}</label>
<input type="number" ng-model="settings.scrollSpeed" min="0" max="1000" />
<span class="help-inline">${settings.scroll_speed.help}</span>
</div>
<div> <div>
<label>${settings.theme}</label> <label>${settings.theme}</label>
<select ng-model="settings.theme" ng-options="theme for theme in themes"></select> <select ng-model="settings.theme" ng-options="theme for theme in themes"></select>