Advertisement
Guest User

Untitled

a guest
Sep 17th, 2019
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 9.21 KB | None | 0 0
  1.  
  2. <!DOCTYPE html>
  3. <html>
  4.  
  5. <head>
  6. <meta http-equiv="Content-Type" content="text/html; charset=windows-1252" />
  7. <style id="stndz-style"></style>
  8. <title>Match the following</title>
  9. <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  10. <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
  11. <link href="https://fonts.googleapis.com/css?family=Poppins&display=swap" rel="stylesheet">
  12. <style>
  13.  
  14.  
  15. body,
  16. html {
  17. text-align: center;
  18. margin: auto;
  19. }
  20. body{
  21. font-family: 'Poppins', sans-serif;
  22. }
  23. #theGame{
  24. height: 100vh;
  25. }
  26. img {
  27. max-width: 100%;
  28. height: auto
  29. }
  30.  
  31. * {
  32. box-sizing: border-box
  33. }
  34.  
  35. #matching-game {
  36. padding: 20px;
  37. max-width: 800px;
  38. margin: 0 auto
  39. }
  40.  
  41. .right-container .right-item {
  42. margin-left: auto
  43. }
  44.  
  45. .row {
  46. margin-left: -15px;
  47. margin-right: -15px
  48. }
  49.  
  50. .row .col {
  51. padding-left: 15px;
  52. padding-right: 15px
  53. }
  54.  
  55. .row.two-col .col {
  56. max-width: 50%;
  57. flex-basis: 50%
  58. }
  59.  
  60. .d-flex {
  61. display: flex;
  62. flex-wrap: wrap
  63. }
  64.  
  65. .left-item,
  66. .right-item {
  67. margin: 0 auto 15px;
  68. border: 2px solid rgba(33,105,249,0.1);
  69. border-radius: 4px;
  70. cursor: pointer;
  71. position: relative;
  72. overflow:hidden;
  73. width: 150px;
  74. height: 100px;
  75. border-radius: 6px;
  76. object-fit: contain;
  77. }
  78.  
  79. .left-item .text-content,
  80. .right-item .text-content {
  81. position: absolute;
  82. top: 50%;
  83. left: 50%;
  84. transform: translate(-50%,-50%);
  85. font-size: 14px;
  86. font-weight: 500;
  87. line-height: 16px;
  88. width:100%;
  89. word-break: break-all;
  90. font-family: 'Poppins', sans-serif;
  91. }
  92.  
  93. .image-content > img {
  94. object-fit: cover;
  95. height: 100%
  96. }
  97.  
  98. .left-selected,
  99. .right-selected {
  100. background: rgba(33,105,249,0.1);
  101. border: 2px solid rgba(33,105,249,0.8);
  102. }
  103.  
  104.  
  105. .message-container {
  106. height: 30px
  107. }
  108.  
  109. .match-complete {
  110. background: rgba(33,105,249,0.1);
  111. }
  112.  
  113. .correct-match {
  114. border-color: #2BAC76 !important;
  115. position: relative;
  116. }
  117.  
  118. .incorrect-match {
  119. border-color: #ff5252 !important;
  120. position: relative;
  121. }
  122.  
  123. .incorrect-match:before,
  124. .correct-match:before {
  125. position: absolute;
  126. display: block;
  127. font-size: 16px;
  128. width: 30px;
  129. height: 30px;
  130. line-height: 30px;
  131. top: 0;
  132. right: 0;
  133. font-family: "FontAwesome";
  134. }
  135.  
  136.  
  137. .incorrect-match:before {
  138. content: "\f00d";
  139. color: #ff5252;
  140. }
  141.  
  142. .correct-match:before {
  143. content: "\f00c";
  144. color: #2BAC76;
  145. }
  146. .jquery-line {
  147. height: 2px !important;
  148. background-color: rgba(33,105,249,0.8) !important;
  149. position: relative;
  150. }
  151. .jquery-line:after,
  152. .jquery-line:before{
  153. position: absolute;
  154. display: block;
  155. font-family: "FontAwesome";
  156. top: -7px;
  157. color:rgba(33,105,249,0.8);
  158. }
  159. .jquery-line:after{
  160. left: -2px;
  161. content: "\F053";
  162. }
  163. .jquery-line:before{
  164. right: -2px;
  165. content: "\F054";
  166.  
  167.  
  168. }
  169.  
  170. .btn-wrapper .btn {
  171. margin: 0 10px;
  172. margin-bottom: 20px;
  173. }
  174.  
  175. .btn {
  176. display: inline-flex;
  177. padding: 0 30px;
  178. font-size: 14px;
  179. min-width: 64px;
  180. line-height: 38px;
  181. box-sizing: border-box;
  182. height: 40px;
  183. font-weight: 400;
  184. border-radius: 30px;
  185. border:none;
  186. text-transform: capitalize;
  187. background: transparent;
  188. font-family: 'Poppins', sans-serif;
  189. }
  190. .btn-primary{
  191. background:#2169f9;
  192. color: #fff;
  193. }
  194.  
  195. .btn-primary:hover {
  196. background: #2169f9;
  197. box-shadow: 0 14px 26px -12px rgba(33, 105, 249, 0.42),
  198. 0 4px 23px 0 rgba(0, 0, 0, 0.12),
  199. 0 8px 10px -5px rgba(33, 105, 249, 0.2);
  200. color: #fff;
  201. }
  202.  
  203. .game-description {
  204. padding: 30px;
  205. }
  206.  
  207. .game-description h1 {
  208. font-size: 26px;
  209. font-weight: 400;
  210. line-height: 28px;
  211. display: inline-block;
  212. margin: 10px 0 15px;
  213. text-align: center;
  214. color: #333;
  215. text-transform: capitalize
  216. }
  217.  
  218. .game-description p {
  219. font-size: 14px;
  220. line-height: 24px;
  221. margin: 0;
  222. padding: 0 30px 15px;
  223. }
  224. </style>
  225. </head>
  226.  
  227. <body>
  228. <!-- LOAD SCRIPTS -->
  229. <script src="../js//jquery.js"></script>
  230. <script type="text/javascript" src="../js/jquery-ui.min.js"></script>
  231. <script type="text/javascript" src="../js/handlebars-v4.1.2.js"></script>
  232. <script src="../../AppAssets/js/helpers.js" type="text/javascript"></script>
  233. <script src="../../AppAssets/js/jquery.domline.min.js" type="text/javascript"></script>
  234. <script type="text/javascript" src="../../AppAssets/js/match-the-following.js"></script>
  235.  
  236. <script id="match-template" type="text/x-handlebars-template">
  237. <div class="container">
  238. <div class="message-container">&nbsp;</div>
  239. <div class="row two-col d-flex">
  240. <div class="col left-container">
  241. {{#each data.left}}
  242. <div class="left-item" data-i="{{i}}">
  243. {{#ifEqual type "text"}}
  244. <span class="text-content">{{content}}</span>
  245. {{/ifEqual}}
  246. {{#ifEqual type "image"}}
  247. <span class="image-content"><img src="{{content}}"></span>
  248. {{/ifEqual}}
  249. </div>
  250. {{/each}}
  251. </div>
  252. <div class="col right-container">
  253. {{#each data.right}}
  254. <div class="right-item" data-i="{{i}}">
  255. {{#ifEqual type "text"}}
  256. <span class="text-content">{{content}}</span>
  257. {{/ifEqual}}
  258. {{#ifEqual type "image"}}
  259. <span class="image-content"><img src="{{content}}"></span>
  260. {{/ifEqual}}
  261. </div>
  262. {{/each}}
  263. </div>
  264. </div>
  265. </div>
  266. </script>
  267.  
  268. <div id=matching-game></div>
  269. <button id="submit-button" style="display:none;"></button>
  270. <script src="../js/game-script.js" type="text/javascript"></script>
  271.  
  272. <script type="text/javascript">
  273. let gameData = [];
  274. let userResult = [];
  275. let isTestMode = false;
  276. let playSounds = true;
  277. let submitResult = false;
  278. let audioPath = "";
  279. const submitButton = document.getElementById("submit-button");
  280.  
  281. var gameEvents = new GameEvents(submitButton);
  282. function submitGame() {
  283. submitResult = true;
  284. let totalItems = gameData.left.length;
  285.  
  286. if (userResult.length !== totalItems) {
  287. self.showMessage("Please answer all of the questions!!!");
  288. return;
  289. }
  290. $("#matching-game").MatchingGame("showAllResults");
  291. gameEvents.saveResult(userResult);
  292. }
  293.  
  294. function setupGame() {
  295. let self = this;
  296. let opts = {
  297. instantResult: isTestMode === false,
  298. allowEdit: true,
  299. template: Handlebars.compile(jQuery("#match-template").html()),
  300. data: gameData
  301. };
  302. jQuery("#matching-game").MatchingGame(opts)
  303. .on("gameComplete", function (e, d) {
  304. userResult = d;
  305. });
  306.  
  307. $(submitButton).on("click", function () {
  308. self.submitGame();
  309. });
  310.  
  311. gameEvents.gameLoaded();
  312. }
  313. </script>
  314. </body>
  315.  
  316. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement