diff --git a/public/js/dots.js b/public/js/dots.js
index 75a6aa6..266c846 100644
--- a/public/js/dots.js
+++ b/public/js/dots.js
@@ -1,17 +1,26 @@
-const truncate = () => {
- $('.uk-card-title').each((i, e) => {
- $(e).dotdotdot({
- truncate: 'letter',
- watch: true,
- callback: (truncated) => {
- if (truncated) {
- $(e).attr('uk-tooltip', $(e).attr('data-title'));
- } else {
- $(e).removeAttr('uk-tooltip');
- }
+/**
+ * Truncate a .uk-card-title element
+ *
+ * @function truncate
+ * @param {object} e - The title element to truncate
+ */
+const truncate = (e) => {
+ $(e).dotdotdot({
+ truncate: 'letter',
+ watch: true,
+ callback: (truncated) => {
+ if (truncated) {
+ $(e).attr('uk-tooltip', $(e).attr('data-title'));
+ } else {
+ $(e).removeAttr('uk-tooltip');
}
- });
+ }
});
};
-truncate();
+$('.uk-card-title').each((i, e) => {
+ // Truncate the title when it first enters the view
+ $(e).one('inview', () => {
+ truncate(e);
+ });
+});
diff --git a/src/views/components/dots-scripts.html.ecr b/src/views/components/dots-scripts.html.ecr
new file mode 100644
index 0000000..41bb7b0
--- /dev/null
+++ b/src/views/components/dots-scripts.html.ecr
@@ -0,0 +1,3 @@
+
+
+
diff --git a/src/views/home.html.ecr b/src/views/home.html.ecr
index f48a2ef..0700f4f 100644
--- a/src/views/home.html.ecr
+++ b/src/views/home.html.ecr
@@ -1,84 +1,83 @@
<%- if new_user && empty_library -%>
-
-
-
Add your first manga
-
We can't find any files yet. Add some to your library and they'll appear here.
-
- - Current library path
- <%= Config.current.library_path %>
- - Want to change your library path?
- - Update
config.yml
located at: <%= Config.current.path %>
- - Can't see your files yet?
- -
- You must wait <%= Config.current.scan_interval %> minutes for the library scan to complete
- <% if is_admin %>
- , or manually re-scan from Admin
- <% end %>.
-
-
-
+
+
+
Add your first manga
+
We can't find any files yet. Add some to your library and they'll appear here.
+
+ - Current library path
+ <%= Config.current.library_path %>
+ - Want to change your library path?
+ - Update
config.yml
located at: <%= Config.current.path %>
+ - Can't see your files yet?
+ -
+ You must wait <%= Config.current.scan_interval %> minutes for the library scan to complete
+ <% if is_admin %>
+ , or manually re-scan from Admin
+ <% end %>.
+
+
+
<%- elsif new_user && empty_library == false -%>
-
-
-
Read your first manga
-
Once you start reading, Mango will remember where you left off
- and show your entries here.
-
View library
-
+
+
+
Read your first manga
+
Once you start reading, Mango will remember where you left off
+ and show your entries here.
+
View library
+
<%- elsif new_user == false && empty_library == false -%>
- <%- if continue_reading.empty? && recently_added.empty? -%>
-
-

-
A self-hosted manga server and reader
-
View library
-
- <%- end -%>
+ <%- if continue_reading.empty? && recently_added.empty? -%>
+
+

+
A self-hosted manga server and reader
+
View library
+
+ <%- end -%>
- <%- unless continue_reading.empty? -%>
- Continue Reading
-
- <%- continue_reading.each do |cr| -%>
- <% item = cr[:entry] %>
- <% progress = cr[:percentage] %>
- <%= render_component "card" %>
- <%- end -%>
-
- <%- end -%>
+ <%- unless continue_reading.empty? -%>
+ Continue Reading
+
+ <%- continue_reading.each do |cr| -%>
+ <% item = cr[:entry] %>
+ <% progress = cr[:percentage] %>
+ <%= render_component "card" %>
+ <%- end -%>
+
+ <%- end -%>
- <%- unless start_reading.empty? -%>
- Start Reading
-
- <%- start_reading.each do |t| -%>
- <% item = t %>
- <% progress = 0.0 %>
- <%= render_component "card" %>
- <%- end -%>
-
- <%- end -%>
+ <%- unless start_reading.empty? -%>
+ Start Reading
+
+ <%- start_reading.each do |t| -%>
+ <% item = t %>
+ <% progress = 0.0 %>
+ <%= render_component "card" %>
+ <%- end -%>
+
+ <%- end -%>
- <%- unless recently_added.empty? -%>
- Recently Added
-
- <%- recently_added.each do |ra| -%>
- <% item = ra %>
- <% progress = ra[:percentage] %>
- <%= render_component "card" %>
- <%- end -%>
-
- <%- end -%>
+ <%- unless recently_added.empty? -%>
+ Recently Added
+
+ <%- recently_added.each do |ra| -%>
+ <% item = ra %>
+ <% progress = ra[:percentage] %>
+ <%= render_component "card" %>
+ <%- end -%>
+
+ <%- end -%>
- <%= render_component "entry-modal" %>
+ <%= render_component "entry-modal" %>
<%- end -%>
<% content_for "script" do %>
-
-
-
-
+ <%= render_component "dots-scripts" %>
+
+
<% end %>
diff --git a/src/views/library.html.ecr b/src/views/library.html.ecr
index 255ccd3..21ec280 100644
--- a/src/views/library.html.ecr
+++ b/src/views/library.html.ecr
@@ -24,8 +24,7 @@
<% content_for "script" do %>
-
-
+ <%= render_component "dots-scripts" %>
<% end %>
diff --git a/src/views/title.html.ecr b/src/views/title.html.ecr
index a66d887..8eb7881 100644
--- a/src/views/title.html.ecr
+++ b/src/views/title.html.ecr
@@ -117,8 +117,7 @@
<% content_for "script" do %>
-
-
+ <%= render_component "dots-scripts" %>