Add Game Title in PS Store

As title for the new PS Store

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         Add Game Title in PS Store
// @version      0.1
// @namespace    https://greasyfork.org/users/179168
// @description  As title for the new PS Store
// @match        https://store.playstation.com/*
// @require      http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js
// @require      https://greasyfork.org/scripts/5392-waitforkeyelements/code/WaitForKeyElements.js?version=115012
// @grant        GM_addStyle
// ==/UserScript==

(function() {
    'use strict';
    waitForKeyElements('div.ems-sdk-product-tile-image__container span img', addGameTitle);

    function addGameTitle (jNode) {
        var alt = $(jNode).attr('alt');
        var grandpa = $(jNode).parent().parent().parent().parent();
        if ($(grandpa).find('section div.game-title').length == 0) {
            $(grandpa).find('section div.price__container').before('<div class="game-title">' + alt + '</div>');
        }
    }
})();

GM_addStyle( `
    .game-title {
        font-size: 14px;
        margin-top: .25rem;
        overflow: hidden;
        display: block;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
    }
`);