From 89f3d5b3c4e912d6b3ef109765caade67131e707 Mon Sep 17 00:00:00 2001 From: Travis Hardiman Date: Wed, 9 Jun 2021 02:12:01 -0400 Subject: [PATCH 1/2] adding noopener noreferrer to external links --- templates/account/create.html | 2 +- templates/account/redeem.html | 2 +- templates/admin/nsfw-users.html | 2 +- templates/misc/promo.html | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/templates/account/create.html b/templates/account/create.html index bc3610c1..5e9c2d8b 100644 --- a/templates/account/create.html +++ b/templates/account/create.html @@ -114,7 +114,7 @@

Create Account

diff --git a/templates/account/redeem.html b/templates/account/redeem.html index cd7d1091..d9252de6 100644 --- a/templates/account/redeem.html +++ b/templates/account/redeem.html @@ -33,7 +33,7 @@

Redeem Coupon

diff --git a/templates/admin/nsfw-users.html b/templates/admin/nsfw-users.html index a72fb36d..9d566fc6 100644 --- a/templates/admin/nsfw-users.html +++ b/templates/admin/nsfw-users.html @@ -20,7 +20,7 @@

{{ escape(user.display_name()) }}

{{escape(user.about)}} {% if user.website %}
-
{{escape(user.website)}} + {{escape(user.website)}} {% end %}

diff --git a/templates/misc/promo.html b/templates/misc/promo.html index 47b45e36..d47087ac 100644 --- a/templates/misc/promo.html +++ b/templates/misc/promo.html @@ -19,7 +19,7 @@ - + Date: Thu, 10 Jun 2021 00:13:23 -0400 Subject: [PATCH 2/2] missing semicolons added, removed unused variables --- static/js/bookmarklet.js | 11 ++++--- static/js/main.js | 62 ++++++++++++++++++-------------------- static/js/paging_keys.js | 4 +-- static/js/portal.jquery.js | 2 +- static/straw/source.js | 10 +++--- 5 files changed, 45 insertions(+), 44 deletions(-) diff --git a/static/js/bookmarklet.js b/static/js/bookmarklet.js index 1a4233fe..6f27c734 100644 --- a/static/js/bookmarklet.js +++ b/static/js/bookmarklet.js @@ -42,11 +42,12 @@ function straw() { // then they came for the youtube videos //if (document.domain == "youtube.com" || document.domain == "localhost" || document.domain == "www.youtube.com"){ + /* if (false){ player_holder = document.getElementById('watch-player'); nodes = player_holder.childNodes; for(var k=0;k" + base + "" : num + ' ' + "" + base + 's' + ""; - } + }; var ShakesCache = { fetch: function() { @@ -280,13 +279,13 @@ $(document).ready(function() { }); $(".save-this").each(function() { - var save_this_view = new SaveThisView(this); + SaveThisView(this); }); // when we hit enter on a form, we want to submit it // even though we don't have an type="submit" input // available, since we're using a styled button. - $sign_in_form = $("#sign-in-form"); + var $sign_in_form = $("#sign-in-form"); $("input", $sign_in_form).keydown(function(e) { if (e.keyCode == 13) { $sign_in_form.submit(); @@ -439,7 +438,7 @@ $(document).ready(function() { save_count: 0, like_count: 0 } - } + }; var SidebarStatsView = function(scope) { // if we aren't on a permalink page, just expose a dummy public API @@ -452,8 +451,8 @@ $(document).ready(function() { } var image_stats = new ImageStats(); - $save_count = $('.save-count', scope); - $like_count = $('.like-count', scope); + var $save_count = $('.save-count', scope); + var $like_count = $('.like-count', scope); image_stats.save_count = parseInt($save_count.html(), 10); image_stats.like_count = parseInt($like_count.html(), 10); @@ -480,7 +479,7 @@ $(document).ready(function() { }, refresh_likes: function() { - $like_count = $('.like-count', scope); + var $like_count = $('.like-count', scope); image_stats.like_count = parseInt($like_count.html(), 10); if (likes_expanded) { this.get_likes(); @@ -494,7 +493,7 @@ $(document).ready(function() { }, refresh_saves: function() { - $save_count = $('.save-count', scope); + var $save_count = $('.save-count', scope); image_stats.save_count = parseInt($save_count.html(), 10); if (saves_expanded) { this.get_saves(); @@ -619,7 +618,7 @@ $(document).ready(function() { $content.removeClass('loading').html(html); } - } + }; }("#sidebar-stats"); SidebarStatsView.init(); @@ -826,13 +825,13 @@ $(document).ready(function() { this.files_on_page[view.share_key] = view; }, refresh_likes: function(share_key) { - view = this.get_view(share_key); + var view = this.get_view(share_key); if (view !== undefined) { view.refresh_likes(); } }, refresh_saves: function(share_key) { - view = this.get_view(share_key); + var view = this.get_view(share_key); if (view !== undefined) { view.refresh_saves(); } @@ -840,14 +839,14 @@ $(document).ready(function() { get_view: function(share_key) { return this.files_on_page[share_key]; } - } + }; function apply_hover_for_video(sel) { sel.hover(function () { if (this.hasAttribute("controls")) { - this.removeAttribute("controls") + this.removeAttribute("controls"); } else { - this.setAttribute("controls", "controls") + this.setAttribute("controls", "controls"); } }); } @@ -855,7 +854,7 @@ $(document).ready(function() { var NSFWCover = function($root) { this.$root = $root; this.init(); - } + }; $.extend(NSFWCover.prototype, { init: function() { @@ -866,7 +865,7 @@ $(document).ready(function() { var location = document.location, host = location.host, protocol = location.protocol, - base_path = location.protocol + "//" + location.host, + base_path = protocol + "//" + host, file_path = $(ev.target).attr('href'); $.get(base_path + "/services/oembed?include_embed=1&url=" + escape(base_path + file_path), $.proxy(this.load_image, this), 'json'); return false; @@ -893,7 +892,7 @@ $(document).ready(function() { $nsfw_cover = $image_content.find(".nsfw-cover"); var stream_stats_view = new StreamStatsView($image_footer); StreamStatsViewRegistry.register(stream_stats_view); - var nsfw_cover = new NSFWCover($nsfw_cover); + NSFWCover($nsfw_cover); }); apply_hover_for_video($('.image-content video.autoplay')); @@ -997,7 +996,6 @@ $(document).ready(function() { var $block = $(this).parents('.notification'); var $header = $("#notifcation-block-shakeinvitation .notification-block-hd"); - var that = this; $.post(url, data, function(response) { if (!response['error']) { $block.remove(); @@ -1027,7 +1025,7 @@ $(document).ready(function() { this.on_shake_page = this.$hd.hasClass('on-shake-page'); var that = this; this.$root.find('.notification').each(function() { - var new_invitation_request = new NotificationInvitationRequest($(this), that); + NotificationInvitationRequest($(this), that); }); }, @@ -1087,11 +1085,11 @@ $(document).ready(function() { }); var init_notification_invitation_request = function() { - $notification_invitation_request = $("#notification-block-invitation-request"); + var $notification_invitation_request = $("#notification-block-invitation-request"); if ($notification_invitation_request.length > 0) { - var invitation_requests = new NotificationInvitationContainer($notification_invitation_request); + NotificationInvitationContainer($notification_invitation_request); } - } + }; init_notification_invitation_request(); // Expand all notifications. @@ -1107,7 +1105,7 @@ $(document).ready(function() { $(".field-submit .btn").click(function() { $(this).closest("form").submit(); return false; - }) + }); /* Site Nav dropdown */ $site_nav = $("#site-nav"); @@ -1171,8 +1169,8 @@ $(document).ready(function() { // http://stackoverflow.com/questions/1125292/how-to-move-cursor-to-end-of-contenteditable-entity function setCaret(el) { - ctrl = el; - pos = ctrl.value.length; + var ctrl = el; + var pos = ctrl.value.length; if(ctrl.setSelectionRange) { ctrl.focus(); @@ -1226,7 +1224,7 @@ $(document).ready(function() { var $image_comments_permalink = $("#image-comments-permalink"); if ($image_comments_permalink.length > 0) { - var new_comment = new PermalinkCommentsView($image_comments_permalink); + PermalinkCommentsView($image_comments_permalink); } $("#nsfw-filter-button a").click(function() { @@ -1300,7 +1298,7 @@ $(document).ready(function() { $("#shake-categories .shake-category").each(function() { - var new_category = new RecommendedShakeCategory(this) + RecommendedShakeCategory(this) }); } @@ -1591,7 +1589,7 @@ $(document).ready(function() { this.clear_input(); this.clear_results(); } - } + }; }(); @@ -1610,7 +1608,7 @@ $(document).ready(function() { var $target = $(ev.target), $li = $target.parents("li"), $form = $target.next(), - url = $form.attr('action'); + url = $form.attr('action'), data = $form.serialize(); if (confirm("Are you sure you want to remove this user from a shake? If they have notifications on an email will be sent informing them of the change.")) { @@ -1626,7 +1624,7 @@ $(document).ready(function() { var $shake_member_list = $("#shake-members-list"); if ($shake_member_list.length > 0) { - var shake_member_list = new ShakeMemberList($shake_member_list); + ShakeMemberList($shake_member_list); } // support for dismissable "Vote 2020" banner; cookie naturally expires on Nov 4th diff --git a/static/js/paging_keys.js b/static/js/paging_keys.js index c145dd01..395058f4 100755 --- a/static/js/paging_keys.js +++ b/static/js/paging_keys.js @@ -184,7 +184,7 @@ var pagingKeys = (function() { return a.y - b.y; }); - var last = item_map.length - 1; + //var last = item_map.length - 1; if (getEl(config.nextPageSelector)[0]) { if (getEl(config.nextPageSelector)[0].href) item_map.push({ id: "next", y: document.body.scrollHeight }); @@ -284,7 +284,7 @@ var pagingKeys = (function() { else if ( getWindowBounds().h + getScrollTop() == document.body.scrollHeight && - 0 < delta + 0 < delta // is this always false? ) p++; diff --git a/static/js/portal.jquery.js b/static/js/portal.jquery.js index 77d9584b..34e64889 100644 --- a/static/js/portal.jquery.js +++ b/static/js/portal.jquery.js @@ -34,7 +34,7 @@ left = e.touches[0].pageX - this.$element.offset().left; top = e.touches[0].pageY - this.$element.offset().top; } - else if (typeof e.changedTouches != 'undefined' && typeof e.changedTouches[0] != 'udefined') { + else if (typeof e.changedTouches != 'undefined' && typeof e.changedTouches[0] != 'undefined') { left = e.changedTouches[0].pageX - this.$element.offset().left; top = e.changedTouches[0].pageY - this.$element.offset().top; } else { diff --git a/static/straw/source.js b/static/straw/source.js index 115c4645..e25c8109 100644 --- a/static/straw/source.js +++ b/static/straw/source.js @@ -110,7 +110,7 @@ java -jar ./tools/compiler.jar --js static/straw/source.js --js_output_file stat if (width > 300 && height > 100) { var left_margin = (width - 240) / 2, top_margin = (height - 45) / 2; - html = 'Save on MLTSHP'; @@ -129,8 +129,8 @@ java -jar ./tools/compiler.jar --js static/straw/source.js --js_output_file stat ev.cancelBubble = true; } - left_location = screen.width/2-450; - top_location = screen.height/2-300; + var left_location = screen.width/2-450; + var top_location = screen.height/2-300; var window_attributes = "width=850,height=650,menubar=yes,toolbar=yes,scrollbars=yes,resizable=yes,left=" + left_location + ",top=" + top_location + "screenX=" + left_location + ",screenY=" + top_location; global.open('https://mltshp.com/tools/p?url=' + encodeURI(this.asset) + '&title=' + encodeURI(global.document.title) + '&source_url=' + encodeURI(global.location.href), 'save_image', window_attributes); }; @@ -221,8 +221,8 @@ java -jar ./tools/compiler.jar --js static/straw/source.js --js_output_file stat find_assets: function() { var images = AssetFinder.images(), images_length = images.length, - videos = AssetFinder.videos(), - videos_length = videos.length, + //videos = AssetFinder.videos(), + //videos_length = videos.length, found = [] for (var i = 0; i < images_length; i++) {