");
window.frames["iframe_show3009"].document.write(decodeHtml($("textarea#stepcodeTextarea3009").val()));
window.frames["iframe_show3009"].document.close();
$(window.frames["iframe_show3009"]).load(function(){
$("#iframe_show3009").height($("#iframe_show3009").contents().find("body").height()+showittryitheight);
});
$("#iframe_show3009").height($("#iframe_show3009").contents().find("body").height()+showittryitheight);
setTimeout(function(){
},500);
});
<!DOCTYPE html>
<script src="http://127.0.0.1/study../../../js/jquery/2.0.0/jquery.min.js"></script>
<link href="http://127.0.0.1/study../../../css/bootstrap/3.3.6/bootstrap.min.css" rel="stylesheet">
<script src="http://127.0.0.1/study../../../js/bootstrap/3.3.6/bootstrap.min.js"></script>
<body>
<style>
p{
margin-left:10px;
margin-top:10px;
}
</style>
<ul id="myTab" class="nav nav-tabs">
<li class="active">
<a href="#dota" data-toggle="tab">
DotA
</a>
</li>
<li><a href="#lol" data-toggle="tab">英雄联盟</a></li>
<li class="dropdown">
<a href="#" id="myTabDrop1" class="dropdown-toggle"
data-toggle="dropdown">其他类似游戏
<b class="caret"></b>
</a>
<ul class="dropdown-menu" role="menu" aria-labelledby="myTabDrop1">
<li><a href="#storm" tabindex="-1" data-toggle="tab">风暴英雄</a></li>
<li><a href="#h300" tabindex="-1" data-toggle="tab">300英雄</a></li>
</ul>
</li>
</ul>
<div id="myTabContent" class="tab-content">
<div class="tab-pane fade in active" id="dota">
<p>《DotA》(Defense of the Ancients),可以译作守护古树、守护遗迹、远古遗迹守卫, 是由暴雪公司出品即时战略游戏《魔兽争霸3》的一款多人即时对战、自定义地图,可支持10个人同时连线游戏,是暴雪公司官方认可的魔兽争霸的RPG地图。</p>
</div>
<div class="tab-pane fade" id="lol">
<p>《英雄联盟》(简称lol)是由美国Riot Games开发,中国大陆地区由腾讯游戏运营的网络游戏。</p>
</div>
<div class="tab-pane fade" id="storm">
<p>
《风暴英雄》 是由暴雪娱乐公司开发的一款运行在Windows和Mac OS上的在线多人竞技PC游戏。</p>
<p> 游戏中的英雄角色主要来自于暴雪三大经典游戏系列:《魔兽世界》、《暗黑破坏神》和《星际争霸》。它是一款道具收费的游戏,与《星际争霸Ⅱ》基于同一引擎开发。
</p>
</div>
<div class="tab-pane fade" id="h300">
<p>《300英雄》是由上海跳跃网络科技有限公司自主研发,深圳中青宝互动网络股份有限公司运营的一款类DOTA网游。游戏以7v7组队对抗玩法为主,提供永恒战场和永恒竞技场两种经典模式任由玩家选择,并创新性地加入勇者斗恶龙、克隆战争等多种休闲娱乐玩法。
</p>
</div>
</div>
<div style="height:200px"></div>
<!DOCTYPE html>
<script src="http://127.0.0.1/study../../../js/jquery/2.0.0/jquery.min.js"></script>
<link href="http://127.0.0.1/study../../../css/bootstrap/3.3.6/bootstrap.min.css" rel="stylesheet">
<script src="http://127.0.0.1/study../../../js/bootstrap/3.3.6/bootstrap.min.js"></script>
<body>
<style>
p{
margin-left:10px;
margin-top:10px;
}
</style>
<ul id="myTab" class="nav nav-tabs">
<li class="active">
<a href="#dota" data-toggle="tab">
DotA
</a>
</li>
<li><a href="#lol" data-toggle="tab">英雄联盟</a></li>
<li class="dropdown">
<a href="#" id="myTabDrop1" class="dropdown-toggle"
data-toggle="dropdown">其他类似游戏
<b class="caret"></b>
</a>
<ul class="dropdown-menu" role="menu" aria-labelledby="myTabDrop1">
<li><a href="#storm" tabindex="-1" data-toggle="tab">风暴英雄</a></li>
<li><a href="#h300" tabindex="-1" data-toggle="tab">300英雄</a></li>
</ul>
</li>
</ul>
<div id="myTabContent" class="tab-content">
<div class="tab-pane fade in active" id="dota">
<p>《DotA》(Defense of the Ancients),可以译作守护古树、守护遗迹、远古遗迹守卫, 是由暴雪公司出品即时战略游戏《魔兽争霸3》的一款多人即时对战、自定义地图,可支持10个人同时连线游戏,是暴雪公司官方认可的魔兽争霸的RPG地图。</p>
</div>
<div class="tab-pane fade" id="lol">
<p>《英雄联盟》(简称lol)是由美国Riot Games开发,中国大陆地区由腾讯游戏运营的网络游戏。</p>
</div>
<div class="tab-pane fade" id="storm">
<p>
《风暴英雄》 是由暴雪娱乐公司开发的一款运行在Windows和Mac OS上的在线多人竞技PC游戏。</p>
<p> 游戏中的英雄角色主要来自于暴雪三大经典游戏系列:《魔兽世界》、《暗黑破坏神》和《星际争霸》。它是一款道具收费的游戏,与《星际争霸Ⅱ》基于同一引擎开发。
</p>
</div>
<div class="tab-pane fade" id="h300">
<p>《300英雄》是由上海跳跃网络科技有限公司自主研发,深圳中青宝互动网络股份有限公司运营的一款类DOTA网游。游戏以7v7组队对抗玩法为主,提供永恒战场和永恒竞技场两种经典模式任由玩家选择,并创新性地加入勇者斗恶龙、克隆战争等多种休闲娱乐玩法。
</p>
</div>
</div>
<div style="height:200px"></div>
");
window.frames["iframe3009"].document.write(decodeHtml(code3009));
window.frames["iframe3009"].document.close();
//load和下面的非load必需并存,因为如果代码用到了jquery就必须使用load的方式
$(window.frames["iframe3009"]).load(function(){
$("#iframe3009").height($("#iframe3009").contents().find("body").height()+showittryitheight);
});
$("#iframe3009").height($("#iframe3009").contents().find("body").height()+showittryitheight);
alreadyWriteCode3009 = code3009;
$("#rendering3009").hide();
$("#rendered3009").show();
}
var tRereshRetry2DemoPanel3009 = setInterval(rereshRetry2DemoPanel3009,1000);
var binded3009 = false;
$("textarea#stepcodeTextarea3009").keyup(function(){
if(!binded3009){
$(window).bind('beforeunload',function(){
binded3009 = true;
return "xxxx";
});
}
var newCode = $(this).val()
code3009 = newCode;
/*below code is replaced by function rereshRetry2DemoPanel()*/
// if(code3009!=newCode){
// window.frames["iframe3009"].document.write("
");
// window.frames["iframe3009"].document.write(decodeHtml($("textarea#stepcodeTextarea3009").val()));
// window.frames["iframe3009"].document.close();
// $(window.frames["iframe3009"]).load(function(){
// $("#iframe3009").height($("#iframe3009").contents().find("body").height()+showittryitheight);
// });
// code3009 = newCode;
// }
});
$(".tryButton3009").click(function(){
$("#tryDiv3009").show();
$("#stepcodeTextarea3009").focus();
$("#stepcodeTextarea3009").height(200);
$("#iframe3009").height(0);
window.frames["iframe3009"].document.write("
");
window.frames["iframe3009"].document.write(decodeHtml($("textarea#stepcodeTextarea3009").val()));
window.frames["iframe3009"].document.close();
//load和下面的非load必需并存,因为如果代码用到了jquery就必须使用load的方式
$(window.frames["iframe3009"]).load(function(){
$("#iframe3009").height($("#iframe3009").contents().find("body").height()+showittryitheight);
});
$("#iframe3009").height($("#iframe3009").contents().find("body").height()+showittryitheight);
this.scrollIntoView(true);
editor3009.focus();
editor3009.setSize(null, "250");
$("#rendering3009").hide();
$("#rendered3009").hide();
});
var mixedMode = {
name: "htmlmixed",
scriptTypes: [{matches: /\/x-handlebars-template|\/x-mustache/i,
mode: null},
{matches: /(text|application)\/(x-)?vb(a|script)/i,
mode: "vbscript"}]
};
var editor3009 = CodeMirror.fromTextArea(document.getElementById("stepcodeTextarea3009"), {
lineNumbers: true,
styleActiveLine: true,
matchBrackets: true,
mode:"text/html",
theme:"eclipse",
selectionPointer: true,
lineWrapping: true,
extraKeys: {
"Alt-/": "autocomplete",
"Ctrl-F": "findPersistent",
"F8": function(cm) {
cm.setOption("fullScreen", !cm.getOption("fullScreen"));
},
"Esc": function(cm) {
if (cm.getOption("fullScreen")) cm.setOption("fullScreen", false);
}
}
});
editor3009.on("change",function(doc){
if(!binded3009){
$(window).bind('beforeunload',function(){
binded3009 = true;
return "xxxx";
});
}
var newCode = doc.getValue();
code3009 = newCode;
$("textarea#stepcodeTextarea3009").val(newCode);
if(alreadyWriteCode3009!=code3009){
lastModifedTime3009 = new Date().getTime();
$("#rendering3009").show();
$("#rendered3009").hide();
}
// alert(doc.getValue());
});
$(".CodeMirror").addClass("form-control");
// var editor3009 = CodeMirror.fromTextArea(, {
// lineNumbers: true,
// styleActiveLine: true,
// matchBrackets: true,
// theme:"eclipse",
// });
editor3009.on("change",function(doc){
// alert(doc.getValue());
});
$("#tryDiv3009").hide();
});
$("div.codemirrorTips span").addClass("glyphicon glyphicon-asterisk");
1. 双击选中单词
2. 三击选中整行
3. CTRL+F 查找
4. F8 全屏编辑,再次点击恢复
|
渲染中
渲染完成
|