Guest User

Untitled

a guest
Jan 22nd, 2018
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 10.86 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5.  
  6.  
  7. <style type="text/css" media="screen">
  8.  
  9. body{
  10. width: 390px;
  11. height: 340px;
  12. padding-top: 15px;
  13. padding-left: 16px;
  14.  
  15. }
  16.  
  17. ol,ul { list-style:none; }
  18.  
  19. a img {
  20. border:0;
  21. outline: none;
  22. }
  23. div {
  24.  
  25. border:0;
  26. outline: none;
  27. }
  28.  
  29. a:hover, a:active, a:focus {
  30. outline: none;
  31. border: 0;
  32. }
  33. a {
  34. cursor: hand;
  35. outline: none;
  36. border: 0;
  37. }
  38.  
  39. .appicon {
  40. padding: 2px;
  41. float: left;
  42. outline: none;
  43. border: 0;
  44. width:95px;
  45. }
  46.  
  47. .appicon:hover {
  48. background-color: #F6AC0C;
  49. }
  50.  
  51. .appicon img {
  52. width: 48px;
  53. height: 48px;
  54. padding-left:20px;
  55. }
  56.  
  57. .appicon a {
  58.  
  59. text-decoration: none;
  60.  
  61. }
  62.  
  63. .apptext {
  64.  
  65. text-align: center;
  66. font: 12px Verdana, Arial, Helvetica, sans-serif;
  67. color: #ffffff;
  68. width: 85px;
  69.  
  70. }
  71.  
  72.  
  73. #slides_container{
  74. float: left;
  75.  
  76.  
  77. }
  78.  
  79. #slides {
  80. }
  81.  
  82. #slides .next {
  83. position: absolute;
  84. top: 148px;
  85. left: 350px;
  86. }
  87.  
  88. #slides .prev {
  89. position: absolute;
  90. top: 148px;
  91. left: 10px;
  92. }
  93.  
  94. .slide {
  95. width: 350px;
  96. }
  97.  
  98. .slides_container {
  99. width:350px;
  100. height: 285px;
  101. }
  102.  
  103. /*
  104. Each slide
  105. Important:
  106. Set the width of your slides
  107. If height not specified height will be set by the slide content
  108. Set to display block
  109. */
  110. .slides_container div.slides_control{
  111. display:block;
  112. }
  113.  
  114. /*
  115. Optional:
  116. Reset list default style
  117. */
  118. .pagination {
  119. list-style:none;
  120. margin:0;
  121. padding:0;
  122. }
  123.  
  124. /*
  125. Optional:
  126. Show the current slide in the pagination
  127. */
  128. .pagination {
  129. margin:26px auto 0;
  130. width:100px;
  131. }
  132.  
  133. .pagination li {
  134. float:left;
  135. margin:0 1px;
  136. list-style:none;
  137. }
  138.  
  139. .pagination li a {
  140. display:block;
  141. width:12px;
  142. height:0;
  143. padding-top:12px;
  144. background-image:url(images/pagination.png);
  145. background-position:0 0;
  146. float:left;
  147. overflow:hidden;
  148. }
  149.  
  150. .pagination li.current a {
  151. background-position:0 -12px;
  152. outline: none;
  153. border: 0;
  154. }
  155.  
  156. .row {
  157. position: absolute;
  158. height:83px;
  159. overflow:hidden;
  160. width: 300px;
  161. }
  162.  
  163. .row0 {
  164.  
  165. top: 10px;
  166. left: 25px;
  167. }
  168.  
  169. .row1 {
  170.  
  171. top: 100px;
  172. left: 25px;
  173.  
  174. }
  175.  
  176. .row2 {
  177.  
  178. top: 200px;
  179. left: 25px;
  180.  
  181. }
  182.  
  183. </style>
  184. </head>
  185. <body onload="initCard()">
  186. <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" />
  187.  
  188. <div id="slides" >
  189.  
  190. <div class="slides_container" id = "slideCon">
  191.  
  192. </div>
  193.  
  194. <a class="next" style="width:23px; height:42px;"></a>
  195. <a class="prev" style="width:23px; height:42px;"></a>
  196. </div>
  197.  
  198. <script src="js/jquery-1.5.1.min.js"></script>
  199. <script src="js/slides.min.jquery.js"></script>
  200.  
  201. <script type="text/jscript" language="jscript">
  202. var Shell = new ActiveXObject("WScript.Shell");
  203. var fso = new ActiveXObject("Scripting.FileSystemObject");
  204. try {
  205. var dataDir = Shell.ExpandEnvironmentStrings("%LocalAppData%") + "\\Bluestacks\\Gadget\\";
  206. //var dataDir = Shell.RegRead ("HKLM\\Software\\Bluestacks\\UserDataDir") + "\\" + "Gadget" + "\\";
  207. } catch(err) {
  208. dataDir = "";
  209. }
  210.  
  211. var TIMEOUT = 3000;
  212. var currentDate = "";
  213. var timerId;
  214. var JSON_FILE = "apps.json";
  215.  
  216. try {
  217. var InstallDir = Shell.RegRead ("HKLM\\Software\\Bluestacks\\InstallDir");
  218. } catch (err) {
  219. //Shell.Popup("Please Install Bluestacks.")
  220. InstallDir = "";
  221. }
  222.  
  223. function readFile(fileName) {
  224. if (fso.FileExists(fileName)) {
  225. var json = getJsonFromFile(fileName);
  226. refreshUI(json);
  227. }
  228. }
  229.  
  230.  
  231. function getJsonFromFile(fileName) {
  232. var f = fso.OpenTextFile(fileName, 1);
  233. var jsonStr = "";
  234. while (!f.AtEndOfStream) {
  235. jsonStr += f.ReadLine();
  236. }
  237. f.Close();
  238.  
  239. return jQuery.parseJSON(jsonStr);
  240. }
  241.  
  242. function refreshUI(json) {
  243. var app, i;
  244. var nApps = json.length;
  245. var ROWS = 3;
  246. var COLS = 3;
  247. var SLIDE = ROWS * COLS;
  248. var slideCon = document.getElementById("slideCon");
  249. var slideNum = -1;
  250. var currentSlide;
  251. var currentRow;
  252. var rowNum = -1;
  253.  
  254. for (i=0; i<nApps; i++) {
  255. if(i % SLIDE === 0) {
  256. slideNum += 1;
  257. currentSlide = createSlide(slideNum);
  258. slideCon.appendChild(currentSlide);
  259. }
  260.  
  261. if(i % ROWS == 0) {
  262. rowNum += 1;
  263. rowNum %= ROWS;
  264. currentRow = createRow(rowNum);
  265. currentSlide.appendChild(currentRow);
  266. }
  267.  
  268. app = createApp(dataDir + json[i].img, json[i].name, json[i].display, json[i].package, json[i].activity);
  269. currentRow.appendChild(app);
  270. }
  271. $(function(){
  272. $('#slides').slides({
  273. generatePagination: true,
  274. slidesLoaded: function () {
  275.  
  276. var slide0 = document.getElementById("slide0");
  277. if(slide0.style.display === "none") {
  278. slide0.style.display = "";
  279. }
  280.  
  281. }
  282. });
  283. });
  284. }
  285.  
  286.  
  287. function createApp(imgPath, appName, displayName, package, activity) {
  288.  
  289. var d = document.createElement("div");
  290. d.className = "apptext";
  291. d.innerText = (displayName === undefined ? appName : displayName);
  292.  
  293. var i = document.createElement("img");
  294. i.setAttribute("src", imgPath);
  295.  
  296. var a = document.createElement("a");
  297.  
  298. if(appName.indexOf("http:") === 0) {
  299. a.setAttribute("href", appName);
  300. } else {
  301. a.onclick = function() { openApp(appName, package, activity) };
  302. }
  303. a.appendChild(i);
  304. a.appendChild(d);
  305.  
  306. var e = document.createElement("div");
  307. e.className = "appicon";
  308. e.appendChild(a);
  309.  
  310. return e;
  311.  
  312. // var textDiv = $("<div>").addClass("apptext").text(appName);
  313. // var img = $("<img>").attr("src", imgPath);
  314. //
  315. // var anchor = $("<a>").click(openApp(appName));
  316. // anchor.append(img).append(textDiv);
  317. //
  318. // return $("<div>").addClass("appicon").append(anchor);
  319. //
  320. }
  321.  
  322. function createSlide(n) {
  323. var d = document.createElement("div");
  324. d.className = "slide";
  325. d.setAttribute("id", "slide" + n);
  326. return d;
  327.  
  328. // return $("<div>", {
  329. // "class": "slide",
  330. // "id": "slide" + n
  331. // });
  332.  
  333. }
  334.  
  335. function createRow(n) {
  336. var d = document.createElement("div");
  337. d.className = "row row" + n;
  338. return d;
  339. //return $("<div>").addClass("row").addClass("row" + n);
  340. }
  341.  
  342. function openApp(name, package, activity) {
  343.  
  344. if(InstallDir === "") {
  345. return;
  346. }
  347.  
  348. var pipe = new ActiveXObject("BlueStacks.hyperDroid.Gadget.HDAgentPipe");
  349. if(package === "" || activity === "")
  350. pipe.Command("run " + name);
  351. else
  352. pipe.Command("runex " + package + "/" + activity);
  353. }
  354.  
  355. function initCard(){
  356. var jsonFile = dataDir + "\\" + JSON_FILE;
  357. if (fso.FileExists(jsonFile)) {
  358. readFile(jsonFile);
  359. }
  360. }
  361.  
  362. function showHTML() {
  363.  
  364. Shell.Popup($("#slideCon").html());
  365. }
  366.  
  367. </script>
  368.  
  369.  
  370. </body>
  371. </html>
Add Comment
Please, Sign In to add comment