PDA

View Full Version : Javascript help



rj
11-14-2013, 12:54 AM
Well simple question... how would I make a .html file that would run some JS code to load only this game: http://ninjakiwi.com/Games/Tower-Defense/Play/Bloons-Tower-Defense-5.html

pages source:

<!DOCTYPE html>
<html>
<head><script type="text/javascript">var NREUMQ=NREUMQ||[];NREUMQ.push(["mark","firstbyte",new Date().getTime()]);</script>
<title>Play Bloons Tower Defense 5 - BTD 5 - Ninja Kiwi, Creators of the best free online TD games on the web - Ninja Kiwi</title>
<meta name="description" content="Halloween, widely regarded as the scariest time of year, has taken over BTD5! Over Halloween you&#x27;ll see some spooky changes to the everyday tools..." />
<meta property="fb:admins" content="100000584646314"/>
<meta property="og:title" content="Bloons Tower Defense 5"/>
<meta property="og:type" content="game"/>
<meta property="og:url" content="http://ninjakiwi.com/Games/Games/Tower-Defense/Play/Bloons-Tower-Defense-5.html"/>
<meta property="og:image" content="http://cdn.ninjakiwi.com/thumbs/large/Ninja-Kiwi-228x174-Update-Icon-Halloween.jpg"/>
<meta property="og:site_name" content="Ninjakiwi" />
<meta property="og:description" content="Halloween, widely regarded as the scariest time of year, has taken over BTD5! Over Halloween you&#x27;ll see some spooky changes to the everyday tools of your monkey troops. Get your pumpkin bombs and bone darts ready for 4 new tracks, Maze, Scorched Earth, Tree Tops and Pumpkin Patch, as well as a few of those obscure Daily Challenge vaults!

Jump into solo play or Coop to try out the new tracks and earn a bunch more Awesome with all the new achievements!

Bloons TD5 has heaps of new features including all of your favourite towers from BTD4 with 8 awesome upgrades each instead of 4, and two brand new never before seen tower types. So much new awesomeness: tower upgrades with cool Super Activated Abilities, new Bloon types, fun new tracks with moving parts and tunnels, powerful Special Agent towers, Daily Rewards, Special Missions, and Daily Challenges - a fun new challenge to play each and every day! Updates are coming all the time, and your progress is tracked for ranks, upgrades, and achievements when you log in using our new NK login system. Have fun!"/>

<link rel="shortcut icon" href="/favicon.ico?v=2" />
<link href='http://fonts.googleapis.com/css?family=PT+Sans+Narrow:400,700|Nobile:400,400it alic,700,700italic' rel='stylesheet' type='text/css'>
<script type="text/javascript" src="https://apis.google.com/js/plusone.js"></script>
<!-- BEGIN TRIGGER TAG INITIALIZATION -->
<script type="text/javascript" src="http://cdn.triggertag.gorillanation.com/js/triggertag.js"></script>
<script type="text/javascript">getTrigger('4892');</script>
<!-- END TRIGGER TAG INITIALIZATION -->

<link href="/assets/application-861b369b8ee144d17896fd53183f700a.css" media="screen" rel="stylesheet" type="text/css" />
<link href="/style/lightbox.css" media="screen" rel="stylesheet" type="text/css" />

<script src="//connect.facebook.net/en_US/all.js"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/swfobject/2.2/swfobject.js"></script>
<!-- BEGIN PINGDOM TRACKING -->
<script>
var _prum = [['id', '517ebf4dabe53d2715000000'],
['mark', 'firstbyte', (new Date()).getTime()]];
(function() {
var s = document.getElementsByTagName('script')[0]
, p = document.createElement('script');
p.async = 'async';
p.src = '//rum-static.pingdom.net/prum.min.js';
s.parentNode.insertBefore(p, s);
})();
</script>
<!-- END PINGDOM TRACKING -->
<!-- BEGIN ANALYTICS TRACKING -->
<script type="text/javascript">

var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-626139-4']);
_gaq.push(['_trackPageview']);

(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://' : 'http://') + 'stats.g.doubleclick.net/dc.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();

</script>
<!-- END ANALYTICS TRACKING -->
<script type='text/javascript'>

var googletag = googletag || {};

googletag.cmd = googletag.cmd || [];

(function() {

var gads = document.createElement('script');

gads.async = true;

gads.type = 'text/javascript';

var useSSL = 'https:' == document.location.protocol;

gads.src = (useSSL ? 'https:' : 'http:') +

'//www.googletagservices.com/tag/js/gpt.js';

var node = document.getElementsByTagName('script')[0];

node.parentNode.insertBefore(gads, node);

})();

</script>



<script type='text/javascript'>

googletag.cmd.push(function() {

googletag.defineSlot('/1010029/New_Site_Game_160x600', [160, 600], 'div-gpt-ad-1374791575637-0').addService(googletag.pubads());

googletag.pubads().enableSingleRequest();

googletag.enableServices();

});

</script>


<script src="//ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script src="/assets/jquery_ujs-a3266ec390218bd1ea234887ff70ab4e.js" type="text/javascript"></script>
<script src="/assets/game_page-c108cecec602349e65c490371c23fb27.js" type="text/javascript"></script>
<script src="/assets/loader-50688b5be48e6584012a0a84bda9d27a.js" type="text/javascript"></script>
<script src="/assets/jquery.autosize-6f59e7d43f6d1b40190d7dea698dcdd7.js" type="text/javascript"></script>
<script src="/assets/jquery.timeago-241e5e07f1e8f2b79dcd01b500fd5441.js" type="text/javascript"></script>
<script src="/assets/jquery.stickyfloat-f56e0e8f683efabbc215b2692ad0754a.js" type="text/javascript"></script>
<script src="/assets/jquery.tiptip-e1c8051f098b87ac18889491466f150a.js" type="text/javascript"></script>
<script src="/assets/swfobject-d562fecb4c7618b56b13b58063b74388.js" type="text/javascript"></script>
<script type="text/javascript">

var swfVersionStr = "10.0.0";
var xiSwfUrlStr = "/assets/expressInstall-0cd5ebb79881d9376f5ef098a0f61edc.swf";
var flashvars = {
file: "http://ninjakiwifiles.com/Games/gameswfs/btd5-dat.swf?v=20131114"
};
var params = {};
params.quality = "high";
params.bgcolor = "#000000";
params.allowscriptaccess = "always";
params.allowfullscreen = "true";
params.wmode = "direct";
var attributes = {};
attributes.id = "game";
attributes.name = "game";

swfobject.embedSWF("http://ninjakiwifiles.com/Games/gameswfs/btd5.swf?v=160512-2", "game_div", "800", "620", swfVersionStr, xiSwfUrlStr, flashvars, params, attributes);

</script>

<script src="//iframe.sponsorpay.com/javascripts/widget/v2/widgets.js" charset="utf-8"></script>
<script type="text/javascript" charset="utf-8">
var _sp_video;

function getFlashMovie(movieName) {
var isIE = navigator.appName.indexOf("Microsoft") != -1;
return (isIE) ? window[movieName] : document[movieName];
}

function checkInventory(userid, appid) {
if (appid === undefined) {
appid = 12549; // Default is BSM2, 14042 is for BTD5
} else {
appid = appid;
}
_sp_video=new SPONSORPAY.Video.Iframe({
appid: appid,
uid: userid,
height: 1000,
width: 1000,
display_format: 'bare_player',
callback_on_start: function(offer) {
gotAVideo("have video");
},
callback_no_offers: function(){
noVideos("sadface");
},
callback_on_close: function(){
cancelledVideo("cancelled");
},
callback_on_conversion: function(){
watchedVideo("converted");
}
});

_sp_video.backgroundLoad();
}

function noVideos(str) {
if ($.browser.mozilla) {
$("#game")[0].noVideos(str);
} else {
getFlashMovie("game").noVideos(str);
}
}

function gotAVideo(str) {
if ($.browser.mozilla) {
$("#game")[0].gotAVideo(str);
} else {
getFlashMovie("game").gotAVideo(str);
}
}

function watchedVideo(str) {
if ($.browser.mozilla) {
$("#game")[0].watchedVideo(str);
} else {
getFlashMovie("game").watchedVideo(str);
}
}

function cancelledVideo(str) {
if ($.browser.mozilla) {
$("#game")[0].cancelledVideo(str);
} else {
getFlashMovie("game").cancelledVideo(str);
}

$("#game").css({
height:"620px"
});
}

function getVideo() {
_sp_video.showVideo();
$("#game").css({
height:"0"
});
}
</script>

<meta content="authenticity_token" name="csrf-param" />
<meta content="NRP6JHwWwsJW8w4MgP7O+L4WnnyObClRUi9DD4DKo18=" name="csrf-token" />
</head>
<body id="play-page" data-user="1265412" class="games-area">
<div class="header-bar">
<div class="wrap">
<div id="header">
<div id="nav">
<a id="logo" href="http://ninjakiwi.com/"><img alt="Nk-logo" src="/logos/nk-logo.png" /></a>
<ul>
<li class="home-pg"><a href="http://ninjakiwi.com/">Home</a></li>
<li class="games-pg">
<a href="/all-games">Games</a>
<div class="dropdown2col">
<div class="popularGamesNav">
<h3>Most Popular Games</h3>
<ul>
<li>
<a href="/Games/Tower-Defense/Bloons-Tower-Defense-5.html">
<img alt="Ninja-kiwi-110x74-update-icon-halloween" src="http://cdn.ninjakiwi.com/thumbs/medium/Ninja-Kiwi-110x74-Update-Icon-Halloween.jpg" />
</a> </li>
<li>
<a href="/Games/Arcade/Bloons-Super-Monkey-2.html">
<img alt="Bsm2-110x74-leaderboard-icon" src="http://ninjakiwi-cdn.s3.amazonaws.com/thumbs/medium/BSM2-110x74-Leaderboard-Icon.jpg" />
</a> </li>
<li>
<a href="/Games/Tower-Defense/Bloons-TD-Battles.html">
<img alt="Battlesnk-110x74-icon_halloween" src="http://ninjakiwi-cdn.s3.amazonaws.com/thumbs/medium/BattlesNK-110x74-Icon_Halloween.jpg" />
</a> </li>
</ul>
</div>
<div class="categoryLists">
<h3>Categories</h3>
<ul>
<li class="tower-defense"><a href="/Games/Tower-Defense">Tower Defense</a></li>
<li class="puzzle"><a href="/Games/Puzzle">Puzzle</a></li>
<li class="action"><a href="/Games/Action">Action</a></li>
<li class="strategy"><a href="/Games/Strategy">Strategy</a></li>
<li class="multiplayer"><a href="/Games/Multiplayer">Multiplayer</a></li>
<li class="mobile"><a href="/Games/Mobile"><span class="translation_missing" title="translation missing: en.game_categories.mobile">Mobile</span></a></li>
<li class="level-editors"><a href="/Games/Level-Editors"><span class="translation_missing" title="translation missing: en.game_categories.level_editors">Level Editors</span></a></li>
<li class="bloons-games"><a href="/Games/Bloons-Games"><span class="translation_missing" title="translation missing: en.game_categories.bloons_games">Bloons Games</span></a></li>
<li class="arcade"><a href="/Games/Arcade">Arcade</a></li>
<li class="all-games"><a href="/all-games">All Games</a></li>
</ul>
</div>
</div>
</li>
<li class="blog-pg">
<a href="/blog">Blog</a>
</li>
<li class="forums-pg"><a href="/forums"><span class="translation_missing" title="translation missing: en.forums">Forums</span></a></li>
<li class="clans-pg falcons"><a href="/clans/falcons"><span class="translation_missing" title="translation missing: en.clan">Clan</span></a></li>

</ul>
<div class="user">
<div class="avatar">
<a href="/profile/dwightshrute">
<img alt="Nk_monkey" src="http://avatars.ninjakiwi.com/small/nk_monkey.png" />
</a> </div>
<div class="details">
<div class="user-nav">
<a href="/profile/dwightshrute">Welcome, dwightshrute</a>
<span>|</span>
<a href="/users/messages" id="messages">Messages</a>
<span>|</span>
<a href="/users/settings" id="settings">Settings</a>
</div>
<div class="user-stats">
<div id="awesome">
475
</div>
<div id="coins">
5
</div>
<a href="/getcoins" class="buy-coins btn" target="_blank">Buy Coins</a>
<a href="/logout" class="logout">Logout</a>
</div>
<a href="#" class="hide-header"></a>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="wrap group " id="content">
<a href="#" class="show-header"></a>
<div id="primary">

<div id="preroll">
<div id="loadbar_container">
<div id="loadbar_behind">
<p>Loading</p>
<div id="loadbar"></div>
</div>
</div>
<div id="video">
<script type="text/javascript">
if(typeof(gnm_ord)=='undefined') gnm_ord=Math.random()*10000000000000000; if(typeof(gnm_tile) == 'undefined') gnm_tile=1;
document.write('<scr'+'ipt src="http://n4403ad.doubleclick.net/adj/gn.ninjakiwi.com/pregame_screen;sect=pregame_screen;sz=300x250;tile ='+(gnm_tile++)+';ord='+gnm_ord+'?" type="text/javascript"></scr'+'ipt>');
</script>
</div>
</div>
<div id="game_container" style="overflow: hidden; height: 800px; width: 620px;">
<div id="game_div">
<p>Get Flash play Ninja Kiwi games.</p>
</div>
</div>
<div class="fb-like" data-send="true" data-width="450" data-show-faces="false" data-colorscheme="dark"></div>
<script>
(function(d){
function postToWall(name, caption, description, picture) {
var postParams = {
method: 'feed',
name: name,
caption: caption,
description: description,
link: 'http://ninjakiwi.com/Games/Tower-Defense/Play/Bloons-Tower-Defense-5.html',
picture: picture,
actions: [
{name: 'Play Bloons TD 5', link: 'http://ninjakiwi.com/Games/Tower-Defense/Play/Bloons-Tower-Defense-5.html'}
]
}

FB.ui(postParams, postResponse);
}

function postResponse(response) {
FB.Dialog.remove(FB.Dialog._active);
}
})
</script>

</div>
<div id="secondary">
<div class="list">



<!-- New_Site_Game_160x600 -->
<div id='div-gpt-ad-1374791575637-0' style='width:160px; height:600px;'>
<script type='text/javascript'>
googletag.cmd.push(function() { googletag.display('div-gpt-ad-1374791575637-0'); });
</script>
</div>


</div>
</div>
<div id="international">
<ul class="group">
<li><a href="/" class="english">English</a></li>
<li><a href="/Francais/Games/Tower-Defense/Play/Bloons-Tower-Defense-5.html" class="francais">Français</a></li>
<li><a href="/Deutsch/Games/Tower-Defense/Play/Bloons-Tower-Defense-5.html" class="deutsch">Deutsch</a></li>
<li><a href="/Portugues/Games/Tower-Defense/Play/Bloons-Tower-Defense-5.html" class="portugues">Português</a></li>
<li><a href="/Espanol/Games/Tower-Defense/Play/Bloons-Tower-Defense-5.html" class="espanol">Español</a></li>
<li><a href="/Polski/Games/Tower-Defense/Play/Bloons-Tower-Defense-5.html" class="polski">Polski</a></li>
<li><a href="/Svenska/Games/Tower-Defense/Play/Bloons-Tower-Defense-5.html" class="svenska">Svenska</a></li>
<li><a href="/Nederlands/Games/Tower-Defense/Play/Bloons-Tower-Defense-5.html" class="nederlands">Nederlands</a></li>
<li><a href="/Norsk/Games/Tower-Defense/Play/Bloons-Tower-Defense-5.html" class="norsk">Norsk</a></li>
<li><a href="/Japanese/Games/Tower-Defense/Play/Bloons-Tower-Defense-5.html" class="japanese">Japanese</a></li>
<li><a href="/Korean/Games/Tower-Defense/Play/Bloons-Tower-Defense-5.html" class="korean">Korean</a></li>
<li><a href="/Chinese/Games/Tower-Defense/Play/Bloons-Tower-Defense-5.html" class="chinese">Chinese</a></li>
</ul>
</div>
<div id="footer">
<ul class="nav">
<li><a href="http://bloonsworld.com/" target="_blank">Bloons World</a></li>
<li><a href="http://ninjakiwi.com/support" target="_blank">Support</a></li>
<li><a href="http://ninjakiwi.com/privacy_policy" target="_blank">Privacy Policy</a></li>
<li><a href="http://ninjakiwi.com/business_contact" target="_blank">Business Contact</a></li>
<li><a href="http://ninjakiwi.com/advertisers" target="_blank">Advertisers</a></li>
<li><a href="http://ninjakiwi.com/terms" target="_blank">Terms</a></li>
<li><a href="http://ninjakiwi.com/advertisers" target="_blank">TotallyHer Teens</a></li>
</ul>
<ul class="nav social">
<li class="facebook"><span></span><a href="https://www.facebook.com/ninjakiwigames" target="_blank">Facebook</a></li>
<li class="twitter"><span></span><a href="https://twitter.com/ninjakiwigames/" target="_blank">Twitter</a></li>
</ul>
<p id="disclaimer">Ninja Kiwi and Bloons are trademarks of Ninja Kiwi Limited, registered in the U.S. and other countries
iPhone and iPad are trademarks of Apple Inc., registered in the U.S. and other countries. App Store is a service mark of Apple Inc.</p>
</div>
</div>
<div id="btd5_ios">
<a href="#" class="close">Close IOS Window</a>
<a href="http://newgam.es/td5iosnknewtop" class="full-link" target="_blank"></a>
<a href="http://newgam.es/td5iosnknewtop" class="buy-iphone" target="_blank">Buy Now iPhone</a>
<a href="http://newgam.es/td5mcobox" class="buy-android" target="_blank">Buy Now Android</a>
</div>
<!-- BEGIN GN Ad Tag for Ninja Kiwi 1000x1000 game -->
<script type="text/javascript">
if ((typeof(f365436)=='undefined' || f365436 > 0) ) {
if(typeof(gnm_ord)=='undefined') gnm_ord=Math.random()*10000000000000000; if(typeof(gnm_tile) == 'undefined') gnm_tile=1;
document.write('<scr'+'ipt src="http://n4403ad.doubleclick.net/adj/gn.ninjakiwi.com/game;sect=game;mtfInline=true;sz=1000x1000;tile='+ (gnm_tile++)+';ord='+gnm_ord+'?" type="text/javascript"></scr'+'ipt>');
}else{
//insert default static image here as default ad
}
</script>
<!-- END AD TAG -->

<!-- Start Quantcast tag -->
<script type="text/javascript">
_qoptions={
qacct:"p-cddeOSj7LLd62"
};
</script>
<script type="text/javascript" src="http://edge.quantserve.com/quant.js"></script>
<noscript>
<img src="http://pixel.quantserve.com/pixel/p-cddeOSj7LLd62.gif" style="display: none;" border="0" height="1" width="1" alt="Quantcast"/>
</noscript>
<!-- End Quantcast tag -->

<img alt="Ajax-loader" class="loader-img" src="/assets/ajax-loader-770bf8cdf531ce793e27e0285e6a14ed.gif" />
<script type="text/javascript">if (!NREUMQ.f) { NREUMQ.f=function() {
NREUMQ.push(["load",new Date().getTime()]);
var e=document.createElement("script");
e.type="text/javascript";
e.src=(("http:"===document.location.protocol)?"http:":"https:") + "//" +
"js-agent.newrelic.com/nr-100.js";
document.body.appendChild(e);
if(NREUMQ.a)NREUMQ.a();
};
NREUMQ.a=window.onload;window.onload=NREUMQ.f;
};
NREUMQ.push(["nrfj","beacon-3.newrelic.com","58db2ecb99",1555067,"Ig5WEUdeXg0DS0pQVAwES0pFXVMY",0,144,new Date().getTime(),"","","","",""]);</script></body>
</html>

bg5
11-14-2013, 01:34 AM
If you want just raw applet go here: http://ninjakiwifiles.com/Games/gameswfs/btd5-dat.swf?v=20131114

rj
11-14-2013, 01:44 AM
If you want just raw applet go here: http://ninjakiwifiles.com/Games/gameswfs/btd5-dat.swf?v=20131114

How do I load that in my own HTML file though? :s

Sin
11-14-2013, 01:53 AM
How do I load that in my own HTML file though? :s

You can embed a class file into an HTML document IIRC.

rj
11-14-2013, 01:54 AM
You can embed a class file into an HTML document IIRC.

how do I embed the game into a html file though

Sin
11-14-2013, 02:03 AM
how do I embed the game into a html file though

That's what i'm saying, compile it into a class file and embed into the html file.

rj
11-14-2013, 02:11 AM
That's what i'm saying, compile it into a class file and embed into the html file.

I don't know how to do that.. how do I do that lol?

bg5
11-14-2013, 02:12 AM
You might find it interesting:

http://stackoverflow.com/questions/7059638/is-it-possible-to-use-jquery-javascript-to-load-in-a-flash-player
http://code.google.com/p/swfobject/wiki/documentation
http://code.google.com/p/swfobject/wiki/api

Sin
11-14-2013, 02:20 AM
It's been ages since i've done HTML, but you have to use the <class> tags. Google it! :P

rj
11-14-2013, 02:43 AM
You might find it interesting:

http://stackoverflow.com/questions/7059638/is-it-possible-to-use-jquery-javascript-to-load-in-a-flash-player
http://code.google.com/p/swfobject/wiki/documentation
http://code.google.com/p/swfobject/wiki/api


nvm got it :D


Hopefully it shall work

Kyle Undefined
11-14-2013, 05:49 AM
Umm, why would you want to use JS to load that? Just embed it...