Kaynağa Gözat

Merge pull request #1050 from Alkarex/jQuery2.2

Update jQuery, and UI bugs (scroll, global and reader views)
Alexandre Alapetite 10 yıl önce
ebeveyn
işleme
2e8a1c47e9

+ 8 - 5
CHANGELOG.md

@@ -1,8 +1,11 @@
 # Changelog
 
-## 2015-xx-xx FreshRSS 1.3.1-beta
+## 2016-xx-xx FreshRSS 1.3.1-beta
+
+* UI
+	* Fixed several small bugs in global and reader view [#1050](https://github.com/FreshRSS/FreshRSS/pull/1050)
+	* Updated to jQuery 2.2 and changed code for auto-load on scroll [#1050](https://github.com/FreshRSS/FreshRSS/pull/1050)
 
-* Nothing for the moment.
 
 ## 2015-11-03 FreshRSS 1.2.0 / 1.3.0-beta
 
@@ -12,13 +15,13 @@
 * Security
 	* Invalid logins now return HTTP 403, to be easier to catch (e.g. fail2ban) [#1015](https://github.com/FreshRSS/FreshRSS/issues/1015)
 * UI
-    * Remove "title" field during installation [#858](https://github.com/FreshRSS/FreshRSS/issues/858)
+	* Remove "title" field during installation [#858](https://github.com/FreshRSS/FreshRSS/issues/858)
 	* Visual alert on categories containing feeds in error [#984](https://github.com/FreshRSS/FreshRSS/pull/984)
 * I18n
 	* Italian [#1003](https://github.com/FreshRSS/FreshRSS/issues/1003)
 * Misc.
-    * Support reverse proxy [#975](https://github.com/FreshRSS/FreshRSS/issues/975)
-    * Make auto-update server URL alterable [#1019](https://github.com/FreshRSS/FreshRSS/issues/1019)
+	* Support reverse proxy [#975](https://github.com/FreshRSS/FreshRSS/issues/975)
+	* Make auto-update server URL alterable [#1019](https://github.com/FreshRSS/FreshRSS/issues/1019)
 
 
 ## 2015-09-12 FreshRSS 1.1.3-beta

+ 2 - 2
app/layout/layout.phtml

@@ -5,10 +5,10 @@
 		<meta name="viewport" content="initial-scale=1.0" />
 		<?php echo self::headTitle(); ?>
 		<?php echo self::headStyle(); ?>
-		<?php echo self::headScript(); ?>
 		<script>//<![CDATA[
 <?php $this->renderHelper('javascript_vars'); ?>
 		//]]></script>
+		<?php echo self::headScript(); ?>
 <?php
 	$url_base = Minz_Request::currentRequest();
 	if (FreshRSS_Context::$next_id !== '') {
@@ -42,7 +42,7 @@
 		<meta name="robots" content="noindex,nofollow" />
 <?php } ?>
 	</head>
-	<body class="<?php echo Minz_Request::param('output', 'normal'); ?>">
+	<body class="<?php echo Minz_Request::actionName(); ?>">
 <?php $this->partial('header'); ?>
 
 <div id="global">

+ 3 - 4
app/views/helpers/javascript_vars.phtml

@@ -4,8 +4,7 @@
 $mark = FreshRSS_Context::$user_conf->mark_when;
 $mail = Minz_Session::param('mail', false);
 $auto_actualize = Minz_Session::param('actualize_feeds', false);
-$hide_posts = (FreshRSS_Context::$user_conf->display_posts ||
-               Minz_Request::param('output') === 'reader');
+$hide_posts = !(FreshRSS_Context::$user_conf->display_posts || Minz_Request::actionName() === 'reader');
 $s = FreshRSS_Context::$user_conf->shortcuts;
 
 $url_login = Minz_Url::display(array(
@@ -19,7 +18,7 @@ $url_logout = Minz_Url::display(array(
 
 echo 'var context={',
 	'auto_remove_article:', FreshRSS_Context::isAutoRemoveAvailable() ? 'true' : 'false', ',',
-	'hide_posts:', $hide_posts ? 'false' : 'true', ',',
+	'hide_posts:', $hide_posts ? 'true' : 'false', ',',
 	'display_order:"', Minz_Request::param('order', FreshRSS_Context::$user_conf->sort_order), '",',
 	'auto_mark_article:', $mark['article'] ? 'true' : 'false', ',',
 	'auto_mark_site:', $mark['site'] ? 'true' : 'false', ',',
@@ -31,7 +30,7 @@ echo 'var context={',
 	'html5_notif_timeout:', FreshRSS_Context::$user_conf->html5_notif_timeout, ',',
 	'auth_type:"', FreshRSS_Context::$system_conf->auth_type, '",',
 	'current_user_mail:', $mail ? ('"' . $mail . '"') : 'null', ',',
-	'current_view:"', Minz_Request::param('output', 'normal'), '"',
+	'current_view:"', Minz_Request::actionName(), '"',
 "},\n";
 
 echo 'shortcuts={',

Dosya farkı çok büyük olduğundan ihmal edildi
+ 0 - 1
p/scripts/jquery.min.js


+ 18 - 27
p/scripts/main.js

@@ -244,20 +244,19 @@ function toggleContent(new_active, old_active) {
 		new_active.toggleClass('active');
 	}
 
-	var box_to_move = "html,body",
-		relative_move = false;
-	if (context['current_view'] == 'global') {
-		box_to_move = "#panel";
-		relative_move = true;
-	}
+	var relative_move = context['current_view'] === 'global',
+		box_to_move = $(relative_move ? "#panel" : "html,body");
 
 	if (context['sticky_post']) {
 		var prev_article = new_active.prevAll('.flux'),
-			new_pos = new_active.position().top,
-			old_scroll = $(box_to_move).scrollTop();
+			new_pos = new_active.offset().top,
+			old_scroll = box_to_move.scrollTop();
 
-		if (prev_article.length > 0 && new_pos - prev_article.position().top <= 150) {
-			new_pos = prev_article.position().top;
+		if (prev_article.length > 0 && new_pos - prev_article.offset().top <= 150) {
+			new_pos = prev_article.offset().top;
+			if (relative_move) {
+				new_pos -= box_to_move.offset().top;
+			}
 		}
 
 		if (context['hide_posts']) {
@@ -267,7 +266,7 @@ function toggleContent(new_active, old_active) {
 
 			if (old_active[0] !== new_active[0]) {
 				new_active.children(".flux_content").first().each(function () {
-					$(box_to_move).scrollTop(new_pos).scrollTop();
+					box_to_move.scrollTop(new_pos).scrollTop();
 				});
 			}
 		} else {
@@ -275,7 +274,7 @@ function toggleContent(new_active, old_active) {
 				new_pos += old_scroll;
 			}
 
-			$(box_to_move).scrollTop(new_pos).scrollTop();
+			box_to_move.scrollTop(new_pos).scrollTop();
 		}
 	}
 
@@ -451,11 +450,8 @@ function auto_share(key) {
 	}
 }
 
-function inMarkViewport(flux, box_to_follow, relative_follow) {
-	var top = flux.position().top;
-	if (relative_follow) {
-		top += box_to_follow.scrollTop();
-	}
+function inMarkViewport(flux, box_to_follow) {
+	var top = flux.offset().top;
 	var height = flux.height(),
 		begin = top + 3 * height / 4,
 		bot = Math.min(begin + 75, top + height),
@@ -466,17 +462,15 @@ function inMarkViewport(flux, box_to_follow, relative_follow) {
 }
 
 function init_posts() {
-	var box_to_follow = $(window),
-		relative_follow = false;
-	if (context['current_view'] == 'global') {
+	var box_to_follow = $(window);
+	if (context['current_view'] === 'global') {
 		box_to_follow = $("#panel");
-		relative_follow = true;
 	}
 
 	if (context['auto_mark_scroll']) {
 		box_to_follow.scroll(function () {
 			$('.not_read:visible').each(function () {
-				if ($(this).children(".flux_content").is(':visible') && inMarkViewport($(this), box_to_follow, relative_follow)) {
+				if ($(this).children(".flux_content").is(':visible') && inMarkViewport($(this), box_to_follow)) {
 					mark_read($(this), true);
 				}
 			});
@@ -490,10 +484,7 @@ function init_posts() {
 				return;
 			}
 			var boxBot = box_to_follow.scrollTop() + box_to_follow.height(),
-				load_more_top = load_more.position().top;
-			if (relative_follow) {
-				load_more_top += box_to_follow.scrollTop();
-			}
+				load_more_top = load_more.offset().top;
 			if (boxBot >= load_more_top) {
 				load_more_posts();
 			}
@@ -765,7 +756,7 @@ function init_nav_entries() {
 	$nav_entries.find('.up').click(function () {
 		var active_item = $(".flux.current"),
 			windowTop = $(window).scrollTop(),
-			item_top = active_item.position().top;
+			item_top = active_item.offset().top;
 
 		if (windowTop > item_top) {
 			$("html,body").scrollTop(item_top);

Bu fark içinde çok fazla dosya değişikliği olduğu için bazı dosyalar gösterilmiyor