Learning.cshtml 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257
  1. 
  2. @{
  3. ViewBag.Title = "Learning";
  4. Layout = "~/Views/Shared/_LayoutLearning.cshtml";
  5. }
  6. @using NEducation.NEduService;
  7. @using NEducation.Content.Texts;
  8. @using NEducation.Controllers
  9. @model NEducation.Models.GrammarModel
  10. <link href="~/Content/assets/css/learning.css" rel="stylesheet" type="text/css" />
  11. <link rel="stylesheet" href="~/Content/assets/css/learning-theory.css" />
  12. <link href="~/Content/assets/css/home-grammar.css" rel="stylesheet" type="text/css" />
  13. <script src="~/Content/assets/js/learning-theory.js" type="text/javascript"></script>
  14. <input type="hidden" id="learning-theory-data" name="" value="#">
  15. <input type="hidden" id="learning-theory-complete" name="" value="/Grammar/LearningFinish?lessonId=@Model.lessonId">
  16. <input type="hidden" id="learning-theory-more-sample" name="" value="#">
  17. <!-- Process -->
  18. <div class="theory-process">
  19. <div class="process-cover">
  20. <span class="theory-process-bar" style="width: 0%"></span>
  21. </div>
  22. </div>
  23. <!-- Body -->
  24. <div class="theory-body">
  25. <div class="body-cover">
  26. <style>
  27. .show-example {
  28. display: block;
  29. }
  30. .hide-example {
  31. display: none;
  32. }
  33. </style>
  34. <!-- Main -->
  35. <div class="theory-data-list" total="@Model.grammars.Count">
  36. @for (int i = 0; i < Model.grammars.Count; i++)
  37. {
  38. var grammar = Model.grammars[i];
  39. <div class="theory-data-item @(@i == 0? " item-current" : "")" index="@i" typeData="@grammar.picture">
  40. <div class="row">
  41. <div class="col-sm-3 col-xs-12 col-sm-offset-1">
  42. <div class="theory-data-img">
  43. <div class="data-img-cover">
  44. <img alt="img" src="@grammar.picture" />
  45. <span class="data-flag"></span>
  46. </div>
  47. </div>
  48. </div>
  49. <div class="col-sm-7 col-xs-12">
  50. <div class="theory-data-content">
  51. <p class="data-title">@grammar.name</p>
  52. <p class="data-detail show-tooltip" datatooltip="">
  53. @Html.Raw(grammar.introduction)
  54. </p>
  55. <div class="data-line"></div>
  56. @if (grammar.listGrammarExample != null)
  57. {
  58. for (int j = 0; j < grammar.listGrammarExample.Count; j++)
  59. {
  60. <div class="grammar-example @(@j==0? "show-example":"hide-example")" index="@(j)">
  61. <p class="data-example">
  62. EXEMPLES:
  63. @if (grammar.listGrammarExample[j].contentType == UtilsController.GetContentType.AUDIO_FILE ||
  64. grammar.listGrammarExample[j].contentType == UtilsController.GetContentType.AUDIO_LINK)
  65. {
  66. <a class="icon-sound main-sound-play" href="javascript:void(0)" sound_url="@grammar.listGrammarExample[j].content ">
  67. </a>
  68. }
  69. </p>
  70. @{ if (grammar.listGrammarExample[j].contentType == NEducation.Controllers.UtilsController.GetContentType.VIDEO_LINK)
  71. {
  72. <iframe class="iframe-testing-video" width="100%" height="77%" src="@grammar.listGrammarExample[j].content" autoplay=false frameborder="0" allowfullscreen style="border-radius:10px;"></iframe>
  73. }
  74. else if (grammar.listGrammarExample[j].contentType == NEducation.Controllers.UtilsController.GetContentType.VIDEO_FILE)
  75. {
  76. <video class="iframe-testing-video" width="100%" height="77%" src="@grammar.listGrammarExample[j].content" controls>
  77. </video>
  78. }
  79. else if (grammar.listGrammarExample[j].contentType == UtilsController.GetContentType.TEXT_TYPE)
  80. {
  81. <p class="data-sentence-en">@grammar.listGrammarExample[j].content</p>
  82. }
  83. else if (grammar.listGrammarExample[j].contentType == UtilsController.GetContentType.PICTURE_FILE)
  84. {
  85. <img style="width:100%;height:75%;padding:0 30% 0 30%" src="@grammar.listGrammarExample[j].content" />
  86. }
  87. }
  88. <p class="data-sentence-en">@Html.Raw(grammar.listGrammarExample[j].description)</p>
  89. <p class="data-sentence-vi">@Html.Raw(grammar.listGrammarExample[j].introduction)</p>
  90. <a href="javascript:void(0)" id="btn-previous" class="data-button-more @(@j==0? "show-example":"hide-example")" index="@j" style="display:@(@j==0? "none":"inline-block")">@Lang.PreviousExample</a>
  91. <a href="javascript:void(0)" id="btn-next" class="data-button-more " index="@j" style="display:inline-block">@Lang.AnotherExample</a>
  92. </div>
  93. }
  94. }
  95. </div>
  96. </div>
  97. <script>
  98. $(document).on('click', '#btn-next', function () {
  99. var audio = document.getElementById('learning-main-audio');
  100. //Pause
  101. audio.pause();
  102. //console.log("btn-next click")
  103. //var divCurrent = $(".grammar-example");
  104. var divCurrent = $(this).parents('.grammar-example');
  105. var indexCur = parseInt($(divCurrent).attr('index'));
  106. //console.log("indexCur: ", indexCur)
  107. var divNext = $(".grammar-example[index='" + (indexCur + 1) + "']");
  108. //console.log("divNext.length: ", divNext.length)
  109. if (divNext.length > 0) {
  110. $(divCurrent).removeClass('show-example');
  111. $(divCurrent).addClass('hide-example');
  112. $(divNext).removeClass('hide-example');
  113. $(divNext).addClass('show-example');
  114. //setTimeout(function () {
  115. // $(divCurrent).css('display', 'none');
  116. //}, 500);
  117. }
  118. });
  119. $(document).on('click', '#btn-previous', function () {
  120. var audio = document.getElementById('learning-main-audio');
  121. //Pause
  122. audio.pause();
  123. //console.log("btn-previous click")
  124. //var divCurrent = $(".grammar-example");
  125. var divCurrent = $(this).parents('.grammar-example');
  126. var indexCur = parseInt($(divCurrent).attr('index'));
  127. //console.log("indexCur: ", indexCur)
  128. var divNext = $(".grammar-example[index='" + (indexCur - 1) + "']");
  129. //console.log("divNext.length: ", divNext.length)
  130. if (divNext.length >= 0) {
  131. $(divCurrent).removeClass('show-example');
  132. $(divCurrent).addClass('hide-example');
  133. $(divNext).removeClass('hide-example');
  134. $(divNext).addClass('show-example');
  135. //setTimeout(function () {
  136. // $(divCurrent).css('display', 'none');
  137. //}, 500);
  138. }
  139. });
  140. </script>
  141. </div>
  142. </div>
  143. }
  144. </div>
  145. </div>
  146. </div>
  147. <!-- Bottom -->
  148. <div class="theory-bottom">
  149. <div class="bottom-cover">
  150. <a href="javascript:void(0)" class="button button-prev">@Lang.GoBack</a>
  151. <div class="theory-list-button">
  152. </div>
  153. <a href="javascript:void(0)" class="button button-next">@Lang.Continue</a>
  154. </div>
  155. </div>
  156. <audio class="speaker-audio-1">
  157. <source class="src" src="" type="audio/mpeg" />
  158. </audio>
  159. <!--******** AUDIO MAIN ******** -->
  160. <audio id="learning-main-audio">
  161. <source class="src" src="" type="audio/mpeg">
  162. </audio>
  163. <script type="text/javascript" src="~/Content/assets/js/voca/learning-main.js"></script>
  164. <script type="text/javascript" src="~/Content/assets/js/voca/testing.js"></script>
  165. <script type="text/javascript">
  166. $(document).on('mouseenter', '.theory-data-item.item-current .show-tooltip[datatooltip]', function () {
  167. $('.learning-tooltip-container .learning-tooltip-content').html($(this).attr('datatooltip'));
  168. var topE = $(this).offset().top;
  169. var leftE = $(this).offset().left;
  170. var widthE = $(this).innerWidth();
  171. var heightE = $(this).innerHeight();
  172. $('.learning-tooltip-container').css({
  173. top: topE + heightE + 15,
  174. left: leftE,
  175. width: widthE,
  176. bottom: 'auto'
  177. });
  178. var heightWindow = window.innerHeight;
  179. var heightT = $('.learning-tooltip-container').innerHeight();
  180. if (topE + heightE + 15 + heightT > heightWindow) {
  181. $('.learning-tooltip-container').css({
  182. top: 'auto',
  183. bottom: 0
  184. });
  185. }
  186. setTimeout(function () {
  187. $('.learning-tooltip-container').stop();
  188. $('.learning-tooltip-container').fadeIn(200);
  189. }, 20);
  190. })
  191. var checkHoverTooltip = 0;
  192. $(document).on('mouseenter', '.learning-tooltip-container', function () {
  193. checkHoverTooltip = 1;
  194. })
  195. $(document).on('mouseleave', '.learning-tooltip-container', function () {
  196. checkHoverTooltip = 0;
  197. $('.learning-tooltip-container').stop();
  198. $('.learning-tooltip-container').fadeOut(200);
  199. })
  200. $(document).on('mouseleave', '.theory-data-item.item-current .show-tooltip[datatooltip]', function () {
  201. setTimeout(function () {
  202. if (checkHoverTooltip == 0) {
  203. $('.learning-tooltip-container').stop();
  204. $('.learning-tooltip-container').fadeOut(200);
  205. }
  206. }, 10);
  207. })
  208. </script>