kalathemes

Gtranslate

Apr 6th, 2022
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 9.53 KB | None | 0 0
  1. <div id="gtranslate_wrapper" style="display:none;z-index:9999999999; position: relative; top: auto; right: auto;"><!-- GTranslate: https://gtranslate.io/ -->
  2. <style type="text/css">
  3.  
  4. .switcher {
  5. text-align:left;
  6. cursor:pointer;
  7. overflow:hidden;
  8. }
  9. .switcher .selected {
  10. display: flex;
  11. align-items: center;
  12. position: relative;
  13. padding-right: 16px;
  14. }
  15. .switcher a {
  16. text-decoration:none;
  17. display:block;
  18. font-size:13px;
  19. -webkit-box-sizing:content-box;
  20. -moz-box-sizing:content-box;
  21. box-sizing:content-box;
  22. }
  23. .switcher::before {
  24. content: '';
  25. width: 100%;
  26. height: 10px;
  27. position: absolute;
  28. top: 100%;
  29. right: 0;
  30. background: transparent;
  31. }
  32. .switcher a img {
  33. vertical-align:middle;
  34. display:inline;
  35. border:0;
  36. padding:0;
  37. margin:0;
  38. opacity:0.8;
  39. margin-right: 15px;
  40. }
  41. .switcher em {
  42. font-size: 9px;
  43. font-weight: 700;
  44. position: absolute;
  45. right: 0;
  46. top: 50%;
  47. transform: translateY(-50%);
  48. }
  49. .switcher a:hover img {
  50. opacity:1;
  51. }
  52. .switcher .selected {
  53. background: transparent;
  54. }
  55. .switcher .selected a {
  56. text-transform: uppercase;
  57. font-weight: 600;
  58. font-size: 13px;
  59. letter-spacing: 1px;
  60. color: #444444;
  61. display: flex;
  62. align-items: center;
  63. }
  64. .switcher .selected a:hover {
  65. color: {{ settings.color_primary }};
  66. }
  67. .switcher .selected a img {
  68. display: none;
  69. }
  70. .switcher .option {
  71. position:absolute;z-index:9998;
  72. border-left:1px solid #dddddd;
  73. border-right:1px solid #dddddd;
  74. border-bottom:1px solid #dddddd;
  75. background-color:#ffffff;
  76. width: 148px;
  77. /* max-height:198px; */
  78. -webkit-box-sizing:content-box;
  79. -moz-box-sizing:content-box;
  80. box-sizing:content-box;
  81. overflow-y:auto;
  82. overflow-x:hidden;
  83. box-shadow: 0 3px 20px -1px rgba(0, 0, 0, 0.1);
  84. right: 0;
  85. top: calc(100% + 6px);
  86. display: none;
  87. animation-duration: 0.3s;
  88. }
  89. .switcher .option a {
  90. z-index: 1;
  91. color:#333333;
  92. line-height: 39px;
  93. padding: 0 20px;
  94. border-top: 1px solid #dddddd;
  95. }
  96. .switcher .option a:hover {
  97. color: #ed145b;
  98. }
  99. .switcher .option a.selected {
  100. color: #ed145b;
  101. }
  102. #selected_lang_name {
  103. float: none;
  104. }
  105. .l_name {
  106. float: none !important;
  107. margin: 0;
  108. }
  109. .switcher .option::-webkit-scrollbar-track{
  110. -webkit-box-shadow:inset 0 0 3px rgba(0,0,0,0.3);
  111. border-radius:5px;
  112. background-color:#F5F5F5;
  113. }
  114. .switcher .option::-webkit-scrollbar {
  115. width:5px;
  116. }
  117. .switcher .option::-webkit-scrollbar-thumb {
  118. border-radius:5px;
  119. -webkit-box-shadow: inset 0 0 3px rgba(0,0,0,.3);
  120. background-color:#888;
  121. }
  122. </style>
  123.  
  124. <div class="switcher notranslate">
  125. <div class="selected selected-{{check_gtranslate}}" data-cs-selected-{{ check_gtranslate }}>
  126. <a href="#" onclick="return false;"><img src="//gtranslate.io/shopify/assets/flags/16/en.png" height="16" width="16" alt="en" /> ENG</a>
  127. <em class="sli sli-arrow-down show-for-large"></em>
  128. <svg class="svg-icon submenu-language-icon hide-for-large">
  129. <use xlink:href="#icon-plus"></use>
  130. </svg>
  131. <svg class="svg-icon submenu-language-icon submenu-language-icon-minus hide-for-large">
  132. <use xlink:href="#icon-minus"></use>
  133. </svg>
  134. </div>
  135. <div class="option">
  136. <a href="#" onclick="doGTranslate('en|en');return false;" title="English" class="nturl selected">
  137. <img src="//gtranslate.io/shopify/assets/flags/16/en.png" height="16" width="16" alt="en" /> ENG</a>
  138. <a href="#" onclick="doGTranslate('en|fr');return false;" title="French" class="nturl"><img src="//gtranslate.io/shopify/assets/flags/16/fr.png" height="16" width="16" alt="fr" /> FRE</a><a href="#" onclick="doGTranslate('en|de');return false;" title="German" class="nturl"><img src="//gtranslate.io/shopify/assets/flags/16/de.png" height="16" width="16" alt="de" /> GER</a><a href="#" onclick="doGTranslate('en|it');return false;" title="Italian" class="nturl"><img src="//gtranslate.io/shopify/assets/flags/16/it.png" height="16" width="16" alt="it" /> ITA</a><a href="#" onclick="doGTranslate('en|ru');return false;" title="Russian" class="nturl"><img src="//gtranslate.io/shopify/assets/flags/16/ru.png" height="16" width="16" alt="ru" /> RUS</a><a href="#" onclick="doGTranslate('en|es');return false;" title="Spanish" class="nturl"><img src="//gtranslate.io/shopify/assets/flags/16/es.png" height="16" width="16" alt="es" /> SPA</a></div>
  139. </div>
  140. <script type="text/javascript">
  141. function GTranslateGetCurrentLang() {var keyValue = document.cookie.match('(^|;) ?googtrans=([^;]*)(;|$)');return keyValue ? keyValue[2].split('/')[2] : null;}
  142. function gt_loadScript(url,callback){var script=document.createElement("SCRIPT");script.type="text/javascript";if(script.readyState){script.onreadystatechange=function(){if(script.readyState=="loaded"||script.readyState=="complete"){script.onreadystatechange=null;callback()}}}else{script.onload=function(){callback()}}script.src=url;document.getElementsByTagName("head")[0].appendChild(script)}
  143. var gtSwitcherJS = function($){
  144. $('.switcher .selected').click(function() {
  145. $('.switcher .option a img').each(function() {if(!$(this)[0].hasAttribute('src'))$(this).attr('src', $(this).attr('src'))});
  146. });
  147. $('.switcher .option').bind('mousewheel', function(e) {var options = $('.switcher .option');if(options.is(':visible'))options.scrollTop(options.scrollTop() - e.originalEvent.wheelDelta);return false;});
  148. if(typeof GTranslateGetCurrentLang == 'function')if(GTranslateGetCurrentLang() != null)$(document).ready(function() {var lang_html = $('div.switcher div.option').find('img[alt="'+GTranslateGetCurrentLang()+'"]').parent().html();if(typeof lang_html != 'undefined')$('div.switcher div.selected a').html(lang_html.replace('data-gt-lazy-', ''));});
  149. };
  150. var addCodeCS = function($){
  151. if (typeof GTranslateGetCurrentLang == 'function'){
  152. if (GTranslateGetCurrentLang() != null) $(document).ready(function() {
  153. $('div.switcher div.option a').removeClass('selected');
  154. $('div.switcher div.option').find('img[alt="' + GTranslateGetCurrentLang() + '"]').parent().addClass('selected');
  155. });
  156. }
  157. $('div.switcher div.option a').on('click',function() {
  158. $('div.switcher div.option a').removeClass('selected');
  159. $(this).addClass('selected');
  160. $('div.switcher div.selected a').html($(this).html());
  161. });
  162. }
  163. gt_loadScript("//ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js", function(){jQuery_gtranslate = jQuery.noConflict(true);gtSwitcherJS(jQuery_gtranslate);addCodeCS(jQuery_gtranslate);});
  164. </script>
  165.  
  166. <style type="text/css">
  167. #goog-gt-tt {display:none !important;}
  168. .goog-te-banner-frame {display:none !important;}
  169. .goog-te-menu-value:hover {text-decoration:none !important;}
  170. body {top:0 !important;}
  171. #google_translate_element2 {display:none!important;}
  172. </style>
  173.  
  174. <div id="google_translate_element2"></div>
  175. <script type="text/javascript">
  176. function googleTranslateElementInit2() {new google.translate.TranslateElement({pageLanguage: 'en',autoDisplay: false}, 'google_translate_element2');}
  177. </script><script type="text/javascript" src="//translate.google.com/translate_a/element.js?cb=googleTranslateElementInit2"></script>
  178.  
  179.  
  180. <script type="text/javascript">
  181. if(typeof GTranslateGetCurrentLang != 'function')function GTranslateGetCurrentLang() {var keyValue = document.cookie.match('(^|;) ?googtrans=([^;]*)(;|$)');return keyValue ? keyValue[2].split('/')[2] : null;}
  182. function GTranslateFireEvent(element,event){try{if(document.createEventObject){var evt=document.createEventObject();element.fireEvent('on'+event,evt)}else{var evt=document.createEvent('HTMLEvents');evt.initEvent(event,true,true);element.dispatchEvent(evt)}}catch(e){}}
  183. function doGTranslate(lang_pair){if(lang_pair.value)lang_pair=lang_pair.value;if(lang_pair=='')return;var lang=lang_pair.split('|')[1];if(GTranslateGetCurrentLang() == null && lang == lang_pair.split('|')[0])return;if(typeof ga!='undefined'){ga('send', 'event', 'GTranslate', lang, location.hostname+location.pathname+location.search);}else{if(typeof _gaq!='undefined')_gaq.push(['_trackEvent', 'GTranslate', lang, location.hostname+location.pathname+location.search]);}var teCombo;var sel=document.getElementsByTagName('select');for(var i=0;i<sel.length;i++)if(/goog-te-combo/.test(sel[i].className))teCombo=sel[i];if(document.getElementById('google_translate_element2')==null||document.getElementById('google_translate_element2').innerHTML.length==0||teCombo.length==0||teCombo.innerHTML.length==0){setTimeout(function(){doGTranslate(lang_pair)},500)}else{teCombo.value=lang;GTranslateFireEvent(teCombo,'change');GTranslateFireEvent(teCombo,'change')}}
  184. </script>
  185. <style type="text/css">a.glink {text-decoration:none;}
  186. a.glink span {margin-right:3px;font-size:10px;vertical-align:middle;}
  187. a.glink img {vertical-align:middle;display:inline;border:0;padding:0;margin:0;opacity:0.8;}
  188. a.glink:hover img {opacity:1;}
  189. </style></div>
  190. <script>setTimeout(function() {if(typeof window.gtranslate_installed == "undefined" && typeof console != "undefined") console.log("To uninstall GTranslate properly please follow the instructions on https://docs.gtranslate.io/how-tos/how-to-remove-gtranslate-app-from-shopify")}, 4000);</script>
Advertisement
Add Comment
Please, Sign In to add comment