Netflix saw it button

Fix netflix thumbnails so you can mark them as watched

您需要先安装一个扩展,例如 篡改猴Greasemonkey暴力猴,之后才能安装此脚本。

You will need to install an extension such as Tampermonkey to install this script.

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴Userscripts ,之后才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。

您需要先安装用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name	Netflix saw it button
// @author	TheGeekProfessor
// @version 1.0
// @namespace tgp_netflix
// @description	Fix netflix thumbnails so you can mark them as watched
// @include	https://www.netflix.com/*
// @require https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js 
// ==/UserScript==

// license	Creative Commons Attribution License


$(document).ready(function() {  
  $('[data-ui-tracking-context]').each(function(){
    // It's  query string that's actually JSON that's actually an array
    id= JSON.parse(decodeURI($(this).data('ui-tracking-context')));
    id = id.video_id;
  	if(localStorage.getItem(id))
      $(this).closest('.title-card-container').addClass('g_watched');
  });
  $('[data-tracking-uuid]').closest('.title-card-container').append('<div class="watched_eye">&#128065;</div>');
  $('.watched_eye').click(function(){
  	$(this).closest('.title-card-container').toggleClass('g_watched');
    id = $(this).closest('.title-card-container').find('[data-ui-tracking-context').data('ui-tracking-context');
 	  id= JSON.parse(decodeURI(id));
    id = id.video_id;
    localStorage.setItem(id,$(this).closest('.title-card-container').hasClass('g_watched'));
    console.log(id);
    console.log(localStorage.getItem(id));
  });
 
  $('head').append( `
    <style>
    .watched_eye {
      font-size: 57px;
      padding: 10px;
      position: absolute;
      bottom: -40px;
      left: 0;
      background: gray;
      border-radius: 6px;
      height: 30px;
      line-height: 30px;
    }
		.watched_eye:hover {
			opacity: .3;
			cursor:pointer;
		}
		.title-card-container.g_watched {
			opacity: .3;
		}
    </style>
  ` );
 
});