Various bug fix due to CSP headers

SiteLibrary added name display on album view
Optimizations & removed some obsolete files
This commit is contained in:
2022-04-09 20:45:48 +08:00
parent 3b4ba29b6e
commit b0ecbe42c3
27 changed files with 214 additions and 665 deletions

View File

@@ -0,0 +1,5 @@
.v_boundary[data-type="AcquireLib"] > span {
background-color: #444;
color: white;
padding: 0.2em 0.5em;
}

View File

@@ -54,12 +54,7 @@
temp = Dand.wrap(
'span', null, "flsf"
, "AcquireLib: " + src
, [
new DataKey( "value", src )
, new IKey(
"style", "background-color: #444; color: white; padding: 0.2em 0.5em;"
)
]
, [ new DataKey( "value", src ) ]
);
insertSnippet(j = snippetWrap("AcquireLib", temp, false, 'span'), Boolean(override));
}

View File

@@ -0,0 +1,5 @@
.v_boundary[data-type="Meta"] > span {
background-color: #444;
color: white;
padding: 0.2em 0.5em;
}

View File

@@ -53,12 +53,7 @@
temp = Dand.wrap(
'span', null, "flsf"
, "Meta Tags"
, [
new DataKey( "value", code )
, new IKey(
"style", "background-color: #444; color: white; padding: 0.2em 0.5em;"
)
]
, [ new DataKey( "value", code ) ]
);
insertSnippet(j = snippetWrap( "Meta", temp, false, "span" ), Boolean(override));
}

View File

@@ -0,0 +1,5 @@
.v_boundary[data-type="RespH"] > span {
background-color: #444;
color: white;
padding: 0.2em 0.5em;
}

View File

@@ -0,0 +1,18 @@
.v_boundary[data-type="Video"] {
width: 640px; height: 390px;
background-color: black;
padding: 0;
}
.v_boundary[data-type="Video"] .v_box {
width: 640px; height: 390px;
position: relative;
display: table-cell;
text-align: center;
vertical-align: middle;
}
.v_boundary[data-type="Video"] .v_description {
text-align: left;
padding-left: 0.5em;
}

View File

@@ -14,43 +14,46 @@
var MessageBox = __import( "Components.MessageBox" );
var getData = __import( "System.Net.getData" );
var BLANK_IMG = __import( "Dandelion.StaticRes.BLANK_IMG" );
var video = function (insertSnippet, snippetWrap, createContext, override)
{
var temp, i, j
, getVimeoThumbnail = function (vtag)
var temp, i, j, imgSrc
, getVimeoThumbnail = function( v )
{
getData("//vimeo.com/api/oembed.json?url=https%3A//vimeo.com/" + vtag.getAttribute("data-value"), setThumbnail.bind(vtag), noThumb.bind(vtag));
getData(
"//vimeo.com/api/oembed.json?url=https%3A//vimeo.com/" + v
, setThumbnail
, noThumb
);
}
, noThumb = function ()
, setImgSrc = function( url )
{
if( imgSrc ) imgSrc.src = url;
}
, noThumb = function () { }
, setThumbnail = function (str)
{
this.style.background = "black url(" + JSON.parse(str)["thumbnail_url"] + ") center center no-repeat";
setImgSrc( JSON.parse(str)["thumbnail_url"] );
}
, handler = function ()
{
// Input fields
var input_url = Dand.wrap('input', null, "v_snippet_input_single", null, new IKey("type", "text"));
// Popup MessageBox
new MessageBox("Insert video snippet"
, Dand.wrape([ Dand.wrapc("v_instruction flsf", "Paste a vimeo/Youtube link below:"), input_url ])
, "OK", "Cancel", visualizer.bind(input_url)
).show();
}
, visualizer = function (submitted, override)
{
var t, v;
if (override)
{
v = override.value;
@@ -83,35 +86,34 @@
}
}
}
if (submitted)
{
// Visualize component
temp = Dand.wrapc('v_box', Dand.wrapc('v_description', "Video(url): " + t)
, [
new DataKey("value", v)
, new DataKey("type", i)
, new IKey("style"
, "width: 640px; height: 390px;"
+ ( (i[0] == "v") ? "" : ("background: black url(//img.youtube.com/vi/" + v + "/hqdefault.jpg) no-repeat center center;") )
)
]
temp = Dand.wrapc('v_box'
, [
Dand.wrapc( 'v_description', i[0].toUpperCase() + i.substr(1) + ": " + v )
, imgSrc = Dand.wrapna( "img", [ new IKey( "src", BLANK_IMG ) ] )
]
, [ new DataKey("value", v), new DataKey("type", i) ]
);
if (i[0] == "v")
if( i[0] == "v" )
{
getVimeoThumbnail(temp);
getVimeoThumbnail( v );
}
else
{
setImgSrc( "//img.youtube.com/vi/" + v + "/hqdefault.jpg" );
}
insertSnippet(j = snippetWrap("Video", temp), Boolean(override));
// Set context menu
createContext(null, j);
}
}
;
if (override)
{
visualizer(true, override);
@@ -123,13 +125,13 @@
}
return true;
};
var compile = function (stage)
{
// [video type=\"youtube\"]" + v[2] + "[/video]
var element = IDOMElement(stage)
, type = element.getDAttribute("type");
return "[video type=\"" + type + "\"]" + element.getDAttribute("value") + "[/video]";
};