如何用url运行jsfiddle结果?

时间:2016-02-09 01:56:34

标签: javascript html jsfiddle

我有这个jsfiddle:

https://jsfiddle.net/foreyez/vdk7guob/

math.randomseed(currentRandomSeed)
math.random()

local tokenListPlan = {}

-- randomly assign weighting distribution
local thresh1, thresh2
while (true) do
    local s0 = math.random(1, 99)
    local s1 = math.random(1, 99)
    local c0 = s0
    local c1 = s1 - c0
    local c2 = 100 - c1 - c0
    if (c0 >= eng.DEVIATION_THRESHOLD and c1 >= eng.DEVIATION_THRESHOLD and c2 >= eng.DEVIATION_THRESHOLD) then
        thresh1 = c0
        thresh2 = c0 + c1
        break
    end
end

-- generate tokens (deterministic based on seed)
for i = 1, sortedCountTarget do
    local token
    local c = 1

    local rnd = math.random(1, 100)
    if (rnd < thresh1) then -- skewed dist
        c = 1
    elseif (rnd < thresh2) then
        c = 2
    else
        c = 3
    end

    if (paramGameMode == eng.GAME_MODE_COLOR) then
        local rnd46 = math.random(4, 6)
        token = {color = c, shape = rnd46}
    elseif (paramGameMode == eng.GAME_MODE_SHAPE) then
        local rnd13 = math.random(1, 3)
        token = {color = rnd13, shape = c + 3}
    else
        local rnd13 = math.random(1, 3)
        local rnd46 = math.random(4, 6)
        token = {color = rnd13, shape = rnd46}
    end

    tokenListPlan[#tokenListPlan + 1] = token
end

我想运行它,这样当我去一个网址时,它只会显示结果窗口(不是编辑器)。所以我只是在屏幕上看到一个空白的“Hello World”。如果jsfiddle有一个查询字符串作为选项执行此操作会很好:https://jsfiddle.net/foreyez/vdk7guob/?run=true或其他。

这可能与jsfiddle,或其他一些解决方法?

p.s我正试图用移动设备测试一些东西,这就是为什么我喜欢我的小提琴(不是编辑器)的网址。

3 个答案:

答案 0 :(得分:91)

/show添加到您网址的末尾:https://jsfiddle.net/foreyez/vdk7guob/show

答案 1 :(得分:7)

如果这仅用于演示目的,那么您应该对此感到满意:https://jsfiddle.net/foreyez/vdk7guob/embedded/result/

与模式一样:

url: https://jsfiddle.net/_USER_/_FIDDLEID_/embedded/result/

答案 2 :(得分:4)

您现在应该使用以下模式使用JShell:

https://fiddle.jshell.net/[USER]/[FIDDLE_ID]/show/

示例:https://fiddle.jshell.net/foreyez/vdk7guob/show

修改:我通过检查页面https://jsfiddle.net/[USER]/[FIDDLE_ID]/

找到了此网址

jshell.net iframe

结果视图是指向jshell.net

的iframe