Initial commit
This commit is contained in:
BIN
data/magic-spoiler.mse-export-template/blank.gif
Normal file
BIN
data/magic-spoiler.mse-export-template/blank.gif
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 49 B |
2
data/magic-spoiler.mse-export-template/desktop.ini
Normal file
2
data/magic-spoiler.mse-export-template/desktop.ini
Normal file
@@ -0,0 +1,2 @@
|
||||
[.ShellClassInfo]
|
||||
LocalizedResourceName=@magic-spoiler.mse-export-template,0
|
||||
248
data/magic-spoiler.mse-export-template/export-template
Normal file
248
data/magic-spoiler.mse-export-template/export-template
Normal file
@@ -0,0 +1,248 @@
|
||||
# Simple exporter for HTML files
|
||||
mse version: 2.0.0
|
||||
game: magic
|
||||
short name: Spoiler
|
||||
full name: List of cards
|
||||
installer group: magic/Export/Spoiler (list of cards)
|
||||
icon: preview.png
|
||||
create directory: true
|
||||
version: 2014-06-19
|
||||
depends on: magic.mse-game 2008-05-18
|
||||
|
||||
########################################################################################
|
||||
|
||||
option field:
|
||||
type: boolean
|
||||
name: include set file
|
||||
description: Should a link to the MSE set file be included in the spoiler?
|
||||
initial: no
|
||||
option field:
|
||||
type: choice
|
||||
name: grouping
|
||||
description: How should cards be grouped?
|
||||
choice: no grouping
|
||||
choice: group by color
|
||||
initial: group by color
|
||||
option field:
|
||||
type: choice
|
||||
name: images
|
||||
choice: no
|
||||
choice: just the image box, linked
|
||||
choice: just the image box, inline
|
||||
choice: full card image, linked
|
||||
choice: full card image, preview
|
||||
choice: full card image only
|
||||
initial: full card image, preview
|
||||
option field:
|
||||
type: boolean
|
||||
name: mana symbols
|
||||
description: Should mana symbols be used, or should they be written as text?
|
||||
option field:
|
||||
type: boolean
|
||||
name: rarity symbols
|
||||
description: Should rarity be shown using a symbol or as text?
|
||||
#doesn't work yet:
|
||||
#option field:
|
||||
# type: boolean
|
||||
# name: list keywords
|
||||
# description: Should the keywords be listed?
|
||||
#option field:
|
||||
# type: boolean
|
||||
# name: fancy scripts
|
||||
# description: Should fancy scripts be used
|
||||
option field:
|
||||
type: choice
|
||||
name: font style
|
||||
choice: default
|
||||
choice: serif
|
||||
choice: sans-serif
|
||||
option field:
|
||||
type: color
|
||||
name: background color
|
||||
initial: rgb(255,255,255)
|
||||
choice:
|
||||
name: white
|
||||
color: rgb(255,255,255)
|
||||
choice:
|
||||
name: black
|
||||
color: rgb(0,0,0)
|
||||
option field:
|
||||
type: color
|
||||
name: text color
|
||||
initial: rgb(0,0,0)
|
||||
choice:
|
||||
name: white
|
||||
color: rgb(255,255,255)
|
||||
choice:
|
||||
name: black
|
||||
color: rgb(0,0,0)
|
||||
|
||||
option style:
|
||||
grouping:
|
||||
render style: both
|
||||
choice images:
|
||||
no grouping: { built_in_image("bool_no") }
|
||||
group by color: /magic.mse-game/stats/card_color.png
|
||||
images:
|
||||
render style: both
|
||||
choice images:
|
||||
no: { built_in_image("bool_no") }
|
||||
font style:
|
||||
render style: both
|
||||
choice images:
|
||||
serif: /magic-spoiler.mse-export-template/serif.png
|
||||
sans-serif: /magic-spoiler.mse-export-template/sans-serif.png
|
||||
|
||||
script:
|
||||
if options.mana_symbols then (
|
||||
symbol_font := "magic-mana-small"
|
||||
symbol_font_size := 12
|
||||
) else (
|
||||
symbols_to_html := to_html
|
||||
)
|
||||
write_card := {
|
||||
if contains(options.images, match:"full card image") then
|
||||
card_image_file := write_image_file(card, file:"card{position(of:card,in:set)}.jpg")
|
||||
else if contains(options.images, match:"image box") and
|
||||
card.image != "" then
|
||||
card_image_file := write_image_file(card.image, file:"card{position(of:card,in:set)}.jpg")
|
||||
else
|
||||
card_image_file := ""
|
||||
if options.images == "full card image, preview" then
|
||||
card_image_preview := write_image_file(card, file:"card-preview{position(of:card,in:set)}.jpg", height: 100)
|
||||
else
|
||||
card_image_preview := card_image_file
|
||||
if options.images == "full card image only" then
|
||||
"<li class='fullcard'><img src='{card_image_file}' alt=''></li>"
|
||||
else
|
||||
"<li class='card'>
|
||||
{if options.images == "full card image, preview" then
|
||||
"<a href='{card_image_file}'><img src='{card_image_preview}' alt='' class='card-image'></a>
|
||||
<span class='name' >{ to_html(card.name ) }</span>"
|
||||
else if card_image_file != "" and contains(options.images, match:"linked") then
|
||||
"<span class='name' ><a href='{card_image_file}'>{ to_html(card.name) }</a></span>"
|
||||
else
|
||||
"<span class='name' >{ to_html(card.name ) }</span>"
|
||||
}<span class='casting-cost' >{ symbols_to_html(card.casting_cost ) }</span>
|
||||
{if card_image_file != "" and contains(options.images, match:"inline") then
|
||||
"<img src='{card_image_preview}' alt='' class='image'>"
|
||||
}
|
||||
<span class='type' >{ to_html(card.type ) }</span>
|
||||
<span class='rarity' >{
|
||||
code := if card.rarity == "" then "C"
|
||||
else if card.rarity == "basic land" then "L"
|
||||
else to_upper(card.rarity[0]) # L,C,U,R,S
|
||||
if options.rarity_symbols then
|
||||
"<img src='{ var := if card.rarity == "" then "common"
|
||||
else if card.rarity == "basic land" then "common"
|
||||
else card.rarity
|
||||
write_image_file(
|
||||
file: "set-symbol-{var}.png",
|
||||
width: 20,
|
||||
symbol_variation(
|
||||
symbol: set.symbol,
|
||||
variation: var
|
||||
)
|
||||
)}' alt='{code}' title='{card.rarity}'>"
|
||||
else code
|
||||
}</span>
|
||||
<span class='rule-text' >{ to_html(card.rule_text ) }</span>
|
||||
<span class='flavor-text' >{ to_html( remove_tag(tag: "<i-flavor>", card.flavor_text) ) }</span>
|
||||
<span class='pt' >{ to_html(card.pt ) }</span>
|
||||
<span class='card-number' >{ to_html(card.card_number ) }</span>
|
||||
</li>"
|
||||
}
|
||||
kind_of_card := { if contains(card.shape, match:"token") then ""
|
||||
else if contains(card.shape, match:"rulestip") then ""
|
||||
else if contains(card.shape, match:"counter") then ""
|
||||
else if contains(card.shape, match:"emblem") then ""
|
||||
else if contains(card.shape, match:"split") then write_card()
|
||||
else if contains(card.shape, match:"double faced") then write_card()
|
||||
else if card.name_2 != "" then write_card()
|
||||
else if card.loyalty != "" then write_card()
|
||||
else if contains(card.shape, match:"leveler") then write_card()
|
||||
else write_card()
|
||||
}
|
||||
write_cards := {
|
||||
"<ul class='cards'>{
|
||||
for each card in sort_list(cards, order_by: {input.card_number}) do
|
||||
kind_of_card()
|
||||
}</ul>"
|
||||
}
|
||||
write_group := {
|
||||
cards := filter_list(cards, filter:
|
||||
{ # The first character of the color_of_card code must be equal to 'code'
|
||||
substring(color_of_card(card:input), begin:0, end:1) == code
|
||||
}
|
||||
)
|
||||
count := number_of_items(in:cards)
|
||||
if count > 0 then
|
||||
"<h2>{title} ({count} {if count == 1 then "card" else "cards"})</h2>" +
|
||||
write_cards()
|
||||
}
|
||||
copy_file("blank.gif")
|
||||
write_image_file(
|
||||
file: "set-symbol.png",
|
||||
width: 200,
|
||||
symbol_variation(symbol: set.symbol, variation: "rare")
|
||||
)
|
||||
write_image_file(
|
||||
file: "set-icon.png",
|
||||
width: 16,
|
||||
heght: 16
|
||||
symbol_variation(symbol: set.symbol, variation: "rare")
|
||||
)
|
||||
# the html page
|
||||
html := "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01//EN\" \"http://www.w3.org/TR/html4/strict.dtd\">
|
||||
<html lang='en'>
|
||||
<head>
|
||||
<title>{ to_html(set.title) }</title>
|
||||
<link rel='stylesheet' type='text/css' href='{copy_file("style.css")}'>
|
||||
<link rel='shortcut icon' type='image/png' href='set-icon.png'>
|
||||
<script type='text/javascript' src='{copy_file("script.js")}'></script>
|
||||
<style type='text/css'>
|
||||
body \{
|
||||
background: {options.background_color};
|
||||
color: {options.text_color};
|
||||
{if options.font_style != "default" then
|
||||
"font-family: {options.font_style};"
|
||||
}
|
||||
\}
|
||||
</style>
|
||||
</head>
|
||||
<body{if options.images == "full card image, preview" then " class='with-previews'"}>
|
||||
<img src='{ write_image_file(
|
||||
file: "set-symbol.png",
|
||||
width: 200,
|
||||
symbol_variation(symbol: set.symbol, variation: "rare")
|
||||
)}' alt='' class='set-symbol'>
|
||||
<h1>{ to_html(set.title) }</h1>
|
||||
<div class='copyright'>{ to_html(set.copyright) }</div>
|
||||
<div class='description'>{ to_html(set.description) }</div>
|
||||
{ if options.include_set_file then
|
||||
"<div class='set-file'><a href='{ write_set_file(file:"set.mse-set") }'>Download set in MSE format</a></div>"
|
||||
}
|
||||
{ if options.grouping == "group by color" then
|
||||
# Codes as by sort_index
|
||||
write_group(title: "Colorless" code:"A") +
|
||||
write_group(title: "White", code:"B") +
|
||||
write_group(title: "Blue", code:"C") +
|
||||
write_group(title: "Black", code:"D") +
|
||||
write_group(title: "Red", code:"E") +
|
||||
write_group(title: "Green", code:"F") +
|
||||
write_group(title: "Multicolor", code:"G") +
|
||||
write_group(title: "Hybrids", code:"H") +
|
||||
write_group(title: "Multicolor split cards", code:"I") +
|
||||
write_group(title: "Colorless", code:"K") +
|
||||
write_group(title: "Non-basic lands", code:"L") +
|
||||
write_group(title: "Basic lands", code:"")
|
||||
else write_cards(cards: cards)
|
||||
}
|
||||
<script><!--
|
||||
init();
|
||||
--></script>
|
||||
</body>
|
||||
</html>"
|
||||
write_text_file(html, file:"index.html")
|
||||
# make sure the urls are relative to the right directory
|
||||
replace(html, match:"<[^<>]*(href|src)='", replace:"&{directory}/")
|
||||
BIN
data/magic-spoiler.mse-export-template/preview.png
Normal file
BIN
data/magic-spoiler.mse-export-template/preview.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 6.8 KiB |
BIN
data/magic-spoiler.mse-export-template/sans-serif.png
Normal file
BIN
data/magic-spoiler.mse-export-template/sans-serif.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 203 B |
74
data/magic-spoiler.mse-export-template/script.js
Normal file
74
data/magic-spoiler.mse-export-template/script.js
Normal file
@@ -0,0 +1,74 @@
|
||||
var isIE = navigator.appVersion.indexOf("MSIE") != -1;
|
||||
|
||||
var preview, preview_img;
|
||||
|
||||
function show_preview(url) {
|
||||
preview.style.display = "block";
|
||||
preview_img.style.backgroundImage = "url("+this.href+")";
|
||||
return false;
|
||||
}
|
||||
|
||||
function hide_preview() {
|
||||
preview.style.display = "none";
|
||||
}
|
||||
|
||||
function fix_preview() {
|
||||
var e = document.documentElement ? document.documentElement : document.body;
|
||||
preview.style.top = e.scrollTop + "px";
|
||||
preview.style.height = e.clientHeight;
|
||||
preview.style.width = e.clientWidth;
|
||||
}
|
||||
|
||||
function nice_preview() {
|
||||
// attach
|
||||
var links = document.getElementsByTagName("A");
|
||||
for (var i in links) {
|
||||
if (/(.jpg|.png|.gif)$/.test(links[i])) {
|
||||
links[i].onclick = show_preview;
|
||||
}
|
||||
}
|
||||
// create divs
|
||||
preview = document.createElement("div");
|
||||
var bg = document.createElement("div");
|
||||
var img = document.createElement("div");
|
||||
preview.id = "preview";
|
||||
bg.id = "preview-bg";
|
||||
img.id = "preview-img";
|
||||
hide_preview();
|
||||
preview.onclick = bg.onclick = img.onclick = hide_preview;
|
||||
preview.appendChild(bg);
|
||||
preview.appendChild(img);
|
||||
document.body.appendChild(preview);
|
||||
preview_img = img;
|
||||
if (isIE) {
|
||||
window.onscroll = fix_preview;
|
||||
fix_preview();
|
||||
}
|
||||
}
|
||||
|
||||
var dir;
|
||||
function fix_img() {
|
||||
if (this.currentStyle.width == 'auto' && this.currentStyle.height == 'auto') {
|
||||
this.style.width = this.offsetWidth + 'px';
|
||||
this.style.height = this.offsetHeight + 'px';
|
||||
}
|
||||
this.onload = null;
|
||||
this.style.filter = 'progid:DXImageTransform.Microsoft.AlphaImageLoader(src="'+this.src+'",sizingMethod="scale")';
|
||||
this.src = dir + "blank.gif";
|
||||
}
|
||||
function fix_png_alpha() {
|
||||
if (!/MSIE (5\.5|6\.)/.test(navigator.userAgent)) return; // only in ie 5.5 and 6
|
||||
dir = document.getElementsByTagName("SCRIPT")[0].src.replace(/[^\/]*$/,''); // dir for blank image
|
||||
var imgs = document.getElementsByTagName("IMG");
|
||||
for (var i in imgs) {
|
||||
var img = imgs[i];
|
||||
if ((/\.png$/i).test(img.src)) {
|
||||
img.onload = fix_img;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function init() {
|
||||
fix_png_alpha();
|
||||
nice_preview();
|
||||
}
|
||||
BIN
data/magic-spoiler.mse-export-template/serif.png
Normal file
BIN
data/magic-spoiler.mse-export-template/serif.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 265 B |
102
data/magic-spoiler.mse-export-template/style.css
Normal file
102
data/magic-spoiler.mse-export-template/style.css
Normal file
@@ -0,0 +1,102 @@
|
||||
.set-symbol {
|
||||
float: right;
|
||||
margin-right: .5em;
|
||||
}
|
||||
|
||||
ul {
|
||||
list-style: none;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
.card {
|
||||
clear: left;
|
||||
margin-top: 1em;
|
||||
border: 1px solid rgb(192,192,192);
|
||||
}
|
||||
|
||||
.card span {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.card .name {
|
||||
font-weight: bold;
|
||||
display: inline;
|
||||
font-family: "Matrix";
|
||||
font-size: larger;
|
||||
}
|
||||
.card .casting-cost {
|
||||
display: inline;
|
||||
font-family: "Magic Symbols", "Magic Symbols 2004";
|
||||
font-size: larger;
|
||||
margin-left: .5em;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
.card .flavor-text {
|
||||
font-style: italic;
|
||||
}
|
||||
.card .card-number {
|
||||
color: rgb(128,128,128);
|
||||
font-size: smaller;
|
||||
}
|
||||
|
||||
|
||||
.with-previews .card {
|
||||
margin-top: 1.1em;
|
||||
min-height: 100px;
|
||||
margin-left: 90px;
|
||||
position: relative;
|
||||
}
|
||||
.card .card-image {
|
||||
height: 100px;
|
||||
position: absolute;
|
||||
left: -85px;
|
||||
top: 3px;
|
||||
border: none;
|
||||
}
|
||||
.card .image {
|
||||
display: block;
|
||||
border: none;
|
||||
}
|
||||
|
||||
span.symbol {
|
||||
display: inline;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
.fullcard {
|
||||
float: left;
|
||||
}
|
||||
h2 {
|
||||
clear: both;
|
||||
}
|
||||
|
||||
/* image preview */
|
||||
#preview-bg {
|
||||
background-color: rgb(0,0,0);
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
cursor: pointer;
|
||||
position: absolute;
|
||||
opacity: 0.7;
|
||||
-moz-opacity: 0.7;
|
||||
filter: alpha(opacity=70);
|
||||
}
|
||||
#preview-img {
|
||||
background-position: 50% 50%;
|
||||
background-repeat: no-repeat;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
cursor: pointer;
|
||||
position: absolute;
|
||||
}
|
||||
#preview {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
* html #preview {
|
||||
position: absolute;
|
||||
}
|
||||
Reference in New Issue
Block a user