Greasy Fork is available in English.

coofoUtils-comicInfo

comicInfo扩展包

이 스크립트는 직접 설치해서 쓰는 게 아닙니다. 다른 스크립트가 메타 명령 // @require https://update.greasyfork.org/scripts/453329/1340176/coofoUtils-comicInfo.js(으)로 포함하여 쓰는 라이브러리입니다.

// ==UserScript==
// @name         coofoUtils-comicInfo
// @namespace    https://github.com/coofo/someScript
// @version      0.0.2
// @license      MIT License
// @description  comicInfo扩展包
// @author       coofo
// @downloadURL  https://github.com/coofo/someScript/raw/main/tampermonkey/coofoUtils-comicInfo.user.js
// @supportURL   https://github.com/coofo/someScript/issues
// ==/UserScript==

(function () {
    'use strict';
    window.coofoUtils.comicInfoUtils = {
        create: function (info) {
            let p = ['Series', 'Title', 'Number', 'Count', 'Volume', 'Summary', 'Notes', 'Year', 'Month', 'Day',
                'Writer', 'Penciller', 'Inker', 'Colorist', 'Letterer', 'CoverArtist', 'Editor', 'Translator',
                'Publisher', 'Imprint', 'Genre', 'Tags', 'Web', 'Format', 'BlackAndWhite', 'Manga', 'Characters',
                'Teams', 'Locations', 'ScanInformation', 'StoryArc', 'StoryArcNumber', 'SeriesGroup', 'AgeRating',
                'CommunityRating', 'PageCount', 'LanguageISO', 'LocalizedSeries'];
            let xml = "<?xml version='1.0' encoding='utf-8'?>\n";
            xml += '<ComicInfo>\n';

            for (let i = 0; i < p.length; i++) {
                let name = p[i];
                let value = info[name];
                if (value !== undefined && value !== null && value.length > 0) {
                    if (typeof value === 'object') {
                        value = value.join(',');
                    }
                    xml += `  <${name}>${coofoUtils.commonUtils.xss.htmlEscape(value)}</${name}>\n`;
                }
            }

            xml += '</ComicInfo>';
            return xml;
        }
    };
})();