JSL 來編寫 HTML。
@cbaril要求的用於執行 JMP 每日提示專案的幻燈片亭模式。 這些提示以 HTML 檔案形式儲存在 JMP 安裝目錄中,並將在瀏覽器中顯示。 以下是一些 JSL,它將建立一個 index.html 檔案來循環播放提示。 這裡確實沒有太多 JSL:載入檔案名稱並將它們插入 HTML/JavaScript 範本中,將結果寫入磁碟並在瀏覽器中開啟它。 大部分的魔力在於 CSS 和 JavaScript;谷歌是我的朋友。 您需要調整您機器的每日目錄提示。 我只使用 FireFox 和其他幾個瀏覽器進行了測試。 您可以更改 1.5 秒過渡(兩處)和 10 秒延遲(一處,10000 毫秒)。
If( JMP Version() < "16", Throw( "This JSL needs JMP 16 or greater" ) );
todd = Match( Left( JMP Version(), 2 ),
"16", "C:\Program Files\SAS\JMP\16\Tip of the Day\",
"17", "C:\Program Files\SAS\JMP\17\Tip of the Day\",
"18", "C:\Program Files\JMP\JMPEA\18\Tip of the Day\",
Throw( "open the jsl and add the tip file location for JMP " || JMP Version() )
);
If( !Directory Exists( todd ), Throw( "Can't find " || todd ) );
todd = Substitute( todd, "\", "/" );
filelist = Filter Each( {f}, Files In Directory( todd ), Ends With( f, ".htm" ) );
filelist = Transform Each( {f}, filelist, "'file://" || todd || f || "'" );
html = Save Text File(
"$temp/index.html",
Eval Insert(
"
<STYLE>
.container_row{
display: grid;
}
.layerVisible, .layerHidden{
grid-column: 1;
grid-row: 1;
}
.layerVisible {
opacity: 1.0;
transition: opacity 1.5s ease-in-out;
}
.layerHidden {
opacity: 0.0;
transition: opacity 1.5s ease-in-out;
}
</STYLE>
<TITLE>JMP ^left(jmpversion(),2)^ tips</TITLE>
<DIV class="container_row">
<DIV class="layerVisible">
<IFRAME id="if_1" src="https://community.jmp.com/" style="width: 2500px;height: 2000px;float: left;margin: 20px;"></IFRAME>
</DIV>
<DIV class="layerHidden">
<IFRAME id="if_2" src="https://community.jmp.com/" style="width: 2500px;height: 2000px;float: left;margin: 20px;"></IFRAME>
</DIV>
</DIV>
<SCRIPT type="text/javascript">
/*
http://www.dynamicdrive.com/forums/showthread.php?73827-Java-Script-for-cycling-through-pages
https://stackoverflow.com/questions/59940969/looking-to-do-transitions-between-iframes-using-javascript
https://stackoverflow.com/questions/6780614/css-how-to-position-two-elements-on-top-of-each-other-without-specifying-a-hei
https://stackoverflow.com/questions/507138/how-to-add-a-class-to-a-given-element
(and others for css transition opacity)
*/
var pages = [
^concatitems(filelist,\!",\!")^
];
var p = 0;
var if_front = document.getElementById('if_1');
var if_back = document.getElementById('if_2');
function loadIframe() {
var page = pages[p];
p = (p+1) % pages.length;
var a = document.createElement('a');
a.href = page;
if_front.src=a;
if_front.parentNode.classList.add('layerVisible');
if_front.parentNode.classList.remove('layerHidden');
if_back.parentNode.classList.add('layerHidden');
if_back.parentNode.classList.remove('layerVisible');
var temp = if_front;
if_front = if_back;
if_back = temp;
setTimeout(loadIframe, 10000); // 1/1000 seconds
}
loadIframe();
</SCRIPT>
"
)
);
Web( html );