Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="utf-8">
- <style type="text/css" media="screen">
- body{
- width: 390px;
- height: 340px;
- padding-top: 15px;
- padding-left: 16px;
- }
- ol,ul { list-style:none; }
- a img {
- border:0;
- outline: none;
- }
- div {
- border:0;
- outline: none;
- }
- a:hover, a:active, a:focus {
- outline: none;
- border: 0;
- }
- a {
- cursor: hand;
- outline: none;
- border: 0;
- }
- .appicon {
- padding: 2px;
- float: left;
- outline: none;
- border: 0;
- width:95px;
- }
- .appicon:hover {
- background-color: #F6AC0C;
- }
- .appicon img {
- width: 48px;
- height: 48px;
- padding-left:20px;
- }
- .appicon a {
- text-decoration: none;
- }
- .apptext {
- text-align: center;
- font: 12px Verdana, Arial, Helvetica, sans-serif;
- color: #ffffff;
- width: 85px;
- }
- #slides_container{
- float: left;
- }
- #slides {
- }
- #slides .next {
- position: absolute;
- top: 148px;
- left: 350px;
- }
- #slides .prev {
- position: absolute;
- top: 148px;
- left: 10px;
- }
- .slide {
- width: 350px;
- }
- .slides_container {
- width:350px;
- height: 285px;
- }
- /*
- Each slide
- Important:
- Set the width of your slides
- If height not specified height will be set by the slide content
- Set to display block
- */
- .slides_container div.slides_control{
- display:block;
- }
- /*
- Optional:
- Reset list default style
- */
- .pagination {
- list-style:none;
- margin:0;
- padding:0;
- }
- /*
- Optional:
- Show the current slide in the pagination
- */
- .pagination {
- margin:26px auto 0;
- width:100px;
- }
- .pagination li {
- float:left;
- margin:0 1px;
- list-style:none;
- }
- .pagination li a {
- display:block;
- width:12px;
- height:0;
- padding-top:12px;
- background-image:url(images/pagination.png);
- background-position:0 0;
- float:left;
- overflow:hidden;
- }
- .pagination li.current a {
- background-position:0 -12px;
- outline: none;
- border: 0;
- }
- .row {
- position: absolute;
- height:83px;
- overflow:hidden;
- width: 300px;
- }
- .row0 {
- top: 10px;
- left: 25px;
- }
- .row1 {
- top: 100px;
- left: 25px;
- }
- .row2 {
- top: 200px;
- left: 25px;
- }
- </style>
- </head>
- <body onload="initCard()">
- <g:background id="background" align="center" style="z-index:-999;position:absolute;top:0;left:0;width:390px;height:340px;" src="images/bg-big.png" />
- <div id="slides" >
- <div class="slides_container" id = "slideCon">
- </div>
- <a class="next" style="width:23px; height:42px;"></a>
- <a class="prev" style="width:23px; height:42px;"></a>
- </div>
- <script src="js/jquery-1.5.1.min.js"></script>
- <script src="js/slides.min.jquery.js"></script>
- <script type="text/jscript" language="jscript">
- var Shell = new ActiveXObject("WScript.Shell");
- var fso = new ActiveXObject("Scripting.FileSystemObject");
- try {
- var dataDir = Shell.ExpandEnvironmentStrings("%LocalAppData%") + "\\Bluestacks\\Gadget\\";
- //var dataDir = Shell.RegRead ("HKLM\\Software\\Bluestacks\\UserDataDir") + "\\" + "Gadget" + "\\";
- } catch(err) {
- dataDir = "";
- }
- var TIMEOUT = 3000;
- var currentDate = "";
- var timerId;
- var JSON_FILE = "apps.json";
- try {
- var InstallDir = Shell.RegRead ("HKLM\\Software\\Bluestacks\\InstallDir");
- } catch (err) {
- //Shell.Popup("Please Install Bluestacks.")
- InstallDir = "";
- }
- function readFile(fileName) {
- if (fso.FileExists(fileName)) {
- var json = getJsonFromFile(fileName);
- refreshUI(json);
- }
- }
- function getJsonFromFile(fileName) {
- var f = fso.OpenTextFile(fileName, 1);
- var jsonStr = "";
- while (!f.AtEndOfStream) {
- jsonStr += f.ReadLine();
- }
- f.Close();
- return jQuery.parseJSON(jsonStr);
- }
- function refreshUI(json) {
- var app, i;
- var nApps = json.length;
- var ROWS = 3;
- var COLS = 3;
- var SLIDE = ROWS * COLS;
- var slideCon = document.getElementById("slideCon");
- var slideNum = -1;
- var currentSlide;
- var currentRow;
- var rowNum = -1;
- for (i=0; i<nApps; i++) {
- if(i % SLIDE === 0) {
- slideNum += 1;
- currentSlide = createSlide(slideNum);
- slideCon.appendChild(currentSlide);
- }
- if(i % ROWS == 0) {
- rowNum += 1;
- rowNum %= ROWS;
- currentRow = createRow(rowNum);
- currentSlide.appendChild(currentRow);
- }
- app = createApp(dataDir + json[i].img, json[i].name, json[i].display, json[i].package, json[i].activity);
- currentRow.appendChild(app);
- }
- $(function(){
- $('#slides').slides({
- generatePagination: true,
- slidesLoaded: function () {
- var slide0 = document.getElementById("slide0");
- if(slide0.style.display === "none") {
- slide0.style.display = "";
- }
- }
- });
- });
- }
- function createApp(imgPath, appName, displayName, package, activity) {
- var d = document.createElement("div");
- d.className = "apptext";
- d.innerText = (displayName === undefined ? appName : displayName);
- var i = document.createElement("img");
- i.setAttribute("src", imgPath);
- var a = document.createElement("a");
- if(appName.indexOf("http:") === 0) {
- a.setAttribute("href", appName);
- } else {
- a.onclick = function() { openApp(appName, package, activity) };
- }
- a.appendChild(i);
- a.appendChild(d);
- var e = document.createElement("div");
- e.className = "appicon";
- e.appendChild(a);
- return e;
- // var textDiv = $("<div>").addClass("apptext").text(appName);
- // var img = $("<img>").attr("src", imgPath);
- //
- // var anchor = $("<a>").click(openApp(appName));
- // anchor.append(img).append(textDiv);
- //
- // return $("<div>").addClass("appicon").append(anchor);
- //
- }
- function createSlide(n) {
- var d = document.createElement("div");
- d.className = "slide";
- d.setAttribute("id", "slide" + n);
- return d;
- // return $("<div>", {
- // "class": "slide",
- // "id": "slide" + n
- // });
- }
- function createRow(n) {
- var d = document.createElement("div");
- d.className = "row row" + n;
- return d;
- //return $("<div>").addClass("row").addClass("row" + n);
- }
- function openApp(name, package, activity) {
- if(InstallDir === "") {
- return;
- }
- var pipe = new ActiveXObject("BlueStacks.hyperDroid.Gadget.HDAgentPipe");
- if(package === "" || activity === "")
- pipe.Command("run " + name);
- else
- pipe.Command("runex " + package + "/" + activity);
- }
- function initCard(){
- var jsonFile = dataDir + "\\" + JSON_FILE;
- if (fso.FileExists(jsonFile)) {
- readFile(jsonFile);
- }
- }
- function showHTML() {
- Shell.Popup($("#slideCon").html());
- }
- </script>
- </body>
- </html>
Add Comment
Please, Sign In to add comment