Guest User

js_styles1.phtml

a guest
Apr 5th, 2017
182
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 13.89 KB | None | 0 0
  1. <?php $_product = $this->getProduct(); ?>
  2.  
  3. <div class="ajaxlogin-login" id="productlistlogin" style="display:none;">Click Here</div>
  4.  
  5. <script>
  6.  
  7. var Aitcg_View_Abstract = Class.create(
  8. {
  9. id : '',
  10. option : null,
  11. editor : null,
  12. preview: null,
  13.  
  14. templateSyntax: /(^|.|\r|\n)({{(\w+)}})/,
  15. templateSettings: null,
  16. scr: null,
  17.  
  18. initialize: function( option ) {
  19. this.option = option;
  20. this.config = option.config;
  21. this.id = this.config.optionId;
  22. this.editor = option.editor;
  23. if(typeof(AitPopupHtml)!= 'undefined') {
  24. Event.observe(document, 'dom:loaded', function(){
  25. $$('body')[0].insert( {bottom:AitPopupHtml} );
  26. });
  27. }
  28. },
  29.  
  30. /**
  31. * @abstract
  32. */
  33. closeEditor: function(){},
  34.  
  35. /**
  36. * Return an array of data necessary to render an editor
  37. *
  38. * @return Object
  39. */
  40. getTemplateSetting: function() {
  41. return this.templateSettings;
  42. },
  43.  
  44. /**
  45. * Init an array of data necessary to render an editor
  46. */
  47. _setTemplateSetting: function()
  48. {
  49. var c = this.config,
  50. t = this.config.text,
  51. scr = this.scr,
  52. options = {
  53. full_image: c.productImage.fullUrl,
  54. rand : c.rand,
  55. option_id : this.id,
  56.  
  57. close_text : t.close,
  58. apply_text : t.apply,
  59. applytext : t.applytext,
  60. reset_text : t.reset,
  61. cancel_text : t.cancel,
  62. save_text : t.save,
  63. edit_text : t.edit,
  64. required_text : t.required,
  65. texttoadd_text : t.texttoadd,
  66. addtext_text : t.addtext,
  67. pickcolor_text : t.pickcolor,
  68. pickcoloroutline_text: t.pickcoloroutline,
  69. pickcolorshadow_text : t.pickcolorshadow,
  70. widthoutline_text : t.widthoutline,
  71. outline_text : t.outline,
  72. shadow_text : t.shadow,
  73. shadowalpha_text : t.shadowalpha,
  74. shadowoffsetx_text : t.shadowoffsetx,
  75. shadowoffsety_text : t.shadowoffsety,
  76. addimage_text : t.addimage,
  77. addmasks_text : t.addmasks,
  78. delmasks_text : t.delmasks,
  79. svg_text : t.svg,
  80. pdf_text : t.pdf,
  81. png_text : t.png,
  82. font_text : t.font,
  83. fontpreview_text : t.fontpreview,
  84. scale_text : t.scale,
  85. print_text : t.print_text,
  86. print_type_top : t.print_type_top,
  87. print_type_bottom : t.print_type_bottom,
  88. print_type_bg : t.print_type_bg,
  89. print_type_mask : t.print_type_mask,
  90. print_type_error : t.print_type_error,
  91.  
  92. masks_title : t.masks_title,
  93. predefined_title : t.predefined_title,
  94. user_title : t.user_title,
  95. text_title : t.text_title,
  96. under_template_text : t.under_template_text,
  97. save_title : t.save_title,
  98. save_about : t.save_about,
  99. buttonHelp : t.buttonHelp,
  100.  
  101. areaSizeX : c.area.sizeX,
  102. areaSizeY : c.area.sizeY,
  103. areaOffsetX : c.area.offsetX,
  104. areaOffsetY : c.area.offsetY,
  105.  
  106. fontOptions : c.tools.Text.fontOptions,
  107. empty_img_url: c.emptyImgUrl
  108. };
  109.  
  110. if (scr) {
  111. // some window rendering variables for template
  112. options['img_width'] = scr.curr.width;
  113. options['img_height'] = scr.curr.height;
  114. options['width'] = Math.floor(c.area.sizeX * scr.mult) + 'px';
  115. options['height'] = Math.floor(c.area.sizeY * scr.mult) + 'px';
  116. options['left'] = Math.max(0, Math.round(c.area.offsetX * scr.mult - 1)) + 'px';
  117. options['top'] = Math.max(0, Math.round(c.area.offsetY * scr.mult - 1)) + 'px';
  118. }
  119.  
  120. Aitoc_Common_Events.dispatch('aitcg_view_set_template_settings', {view: this, options: options});
  121.  
  122. this.templateSettings = options;
  123. },
  124.  
  125. /**
  126. * Render a bottom control panel of the editor
  127. *
  128. * @return string
  129. */
  130. _getControlPanelHtml: function()
  131. {
  132. if (this.config.editorEnabled) {
  133. return '<div id="aitcg-control-panel">' +
  134. '<button onclick="return setproductlogin(\'<?php echo Mage::registry("current_product")->getId()?>\', event);setrequestlogin();" class="aitcg-button apply-but" id="submit-editorApply-{{rand}}" title="{{apply_text}}">{{apply_text}}</button>' +
  135. '<button class="aitcg-button reset-but" id="submit-editorReset-{{rand}}" title="{{reset_text}}">{{reset_text}}</button>' +
  136. '</div>';
  137. }
  138. return '';
  139. },
  140.  
  141. /**
  142. * Init Apply and Reset buttons events
  143. */
  144.  
  145. /* add to cart - no direct click */
  146.  
  147. initObservers: function()
  148. {
  149. if (this.config.editorEnabled && this.config.isUserLoggedIn == 'true') {
  150. $('submit-editorApply-' + this.config.rand).observe('click', this.submitApply.bindAsEventListener(this));
  151. $('submit-editorReset-' + this.config.rand).observe('click', this.submitReset.bindAsEventListener(this));
  152. }
  153. },
  154.  
  155.  
  156. submitApply: function(event)
  157. {
  158. Event.stop(event);
  159. this.option.apply();
  160. //jQuery("#aitcg-control-panel").show();
  161. },
  162.  
  163. submitReset: function(event)
  164. {
  165. Event.stop(event);
  166. this.option.reset();
  167. },
  168.  
  169. /**
  170. * Render editor popup header and
  171. * toolbox if editor in enabled
  172. *
  173. * @return string
  174. */
  175. _getToolsHtml: function()
  176. {
  177. return this.option.tools.render();
  178. },
  179.  
  180. initPreview: function()
  181. {
  182. var scale = this.option.calcScale(),
  183. elementId = this.config.previewContainer,
  184. container = $(elementId),
  185. c = this.config,
  186. area = c.area,
  187. thumb = c.productImage.thumb;
  188. this.previewScale = scale;
  189.  
  190. var areaParams = {
  191. width : Math.round(area.sizeX * scale),
  192. height: Math.round(area.sizeY * scale),
  193. left : Math.round(area.offsetX * scale),
  194. top : Math.round(area.offsetY * scale)
  195. };
  196.  
  197. var html =
  198. '<div class="aitraph aitraph-bot"></div>' +
  199. '<img class="aitcg_preview_bg" src="' + thumb.fullUrl + '" />'+
  200. '<div class="aitraph aitraph-top"></div>' +
  201. '<div class="aitcg-overlay" style="width:'+ thumb.sizeX +'px;height:'+thumb.sizeY+'px;"></div>';
  202. container.update(html);
  203.  
  204. this._showPreviewBlock( container );
  205.  
  206. container.observe('click', this.onPreviewClick.bind(this));
  207.  
  208. var title = c.editorEnabled ? c.text.thumbTooltipEdit : c.text.thumbTooltipPreview,
  209. viewIconClass = c.editorEnabled ? '' : 'view-icon';
  210. container.select('.aitcg-overlay')[0]
  211. .observe('mouseover', function(){Aitcg.tooltip().update(title).show()})
  212. .observe('mouseout', function(){Aitcg.tooltip().hide()})
  213. .addClassName(viewIconClass);
  214.  
  215.  
  216. var styleParams = Aitcg.addPxToValue(areaParams);
  217. $$('#' + elementId + ' .aitraph').each( function(element) {
  218. element.setStyle(styleParams);
  219. });
  220.  
  221. Aitoc_Common_Events.dispatch('aitcg_option_preview_create_after_' + this.id, {element: container});
  222.  
  223. this.preview = new Aitcg_Editor(this.option);
  224. this.preview.init(container, Aitcg_Editor.MODE_PREVIEW, true, this.previewScale);
  225. this.preview.load( $('options_' + this.id).getValue() );
  226. this.switchToEditor();
  227. this.startEditor();
  228. },
  229.  
  230. previewReset: function()
  231. {
  232. this.preview.reset();
  233. this.preview.load( $('options_' + this.id).getValue() );
  234. },
  235.  
  236. /**
  237. * @abstract
  238. *
  239. * @param container
  240. * @private
  241. */
  242. _showPreviewBlock: function( container ){},
  243.  
  244. /**
  245. * @abstract
  246. */
  247. onPreviewClick: function(){},
  248.  
  249. /**
  250. * Render some template using current view options
  251. *
  252. * @param template String
  253. * @return string.
  254. */
  255. renderTemplate: function( template )
  256. {
  257. var tempObj = new Template(template, this.templateSyntax),
  258. options = this.getTemplateSetting();
  259. return tempObj.evaluate(options)
  260. },
  261.  
  262. _setVYAProductImage: function()
  263. {
  264. this._setTemplateSetting();
  265. this.initPreview();
  266. }
  267. });
  268.  
  269.  
  270.  
  271.  
  272. </script>
  273.  
  274. <script>
  275.  
  276. function setproductlogin(pid, event)
  277. {
  278. event.preventDefault();
  279. document.getElementById("likeproduct_id").value=pid;
  280. jQuery("#productlistlogin").trigger("click");
  281. return false;
  282. }
  283.  
  284. </script>
  285.  
  286.  
  287. <?php
  288. /* check current page is product */
  289. if(Mage::app()->getFrontController()->getAction()->getFullActionName() =='catalog_product_view'){ ?>
  290.  
  291. <script type="text/javascript" src="<?php echo $this->getJsUrl('aitoc/aitcg/Aitcg.js')?>"></script>
  292. <script type="text/javascript" src="<?php echo $this->getJsUrl('aitoc/aitcg/Aitcg/Option.js')?>"></script>
  293. <script type="text/javascript" src="<?php echo $this->getJsUrl('aitoc/aitcg/Aitcg/Tooltip.js')?>"></script>
  294. <script type="text/javascript" src="<?php echo $this->getJsUrl('aitoc/aitcg/Aitcg/View/Popup.js')?>"></script>
  295. <script type="text/javascript" src="<?php echo $this->getJsUrl('aitoc/aitcg/Aitcg/View/Gallery.js')?>"></script>
  296. <script type="text/javascript" src="<?php echo $this->getJsUrl('aitoc/aitcg/Aitcg/View/Gallery_Rwd.js')?>"></script>
  297. <script type="text/javascript" src="<?php echo $this->getJsUrl('aitoc/aitcg/Aitcg/Editor/Canvas/Abstract.js')?>"></script>
  298. <script type="text/javascript" src="<?php echo $this->getJsUrl('aitoc/aitcg/Aitcg/Editor/Canvas.js')?>"></script>
  299. <script type="text/javascript" src="<?php echo $this->getJsUrl('aitoc/aitcg/Aitcg/Editor/Canvas/Mirror.js')?>"></script>
  300. <script type="text/javascript" src="<?php echo $this->getJsUrl('aitoc/aitcg/Aitcg/Editor/Canvas/Shape.js')?>"></script>
  301. <script type="text/javascript" src="<?php echo $this->getJsUrl('aitoc/aitcg/Aitcg/Editor/Canvas/Trackers.js')?>"></script>
  302. <script type="text/javascript" src="<?php echo $this->getJsUrl('aitoc/aitcg/Aitcg/Editor/Canvas/Tracker/Abstract.js')?>"></script>
  303. <script type="text/javascript" src="<?php echo $this->getJsUrl('aitoc/aitcg/Aitcg/Editor/Canvas/Tracker/Box.js')?>"></script>
  304. <script type="text/javascript" src="<?php echo $this->getJsUrl('aitoc/aitcg/Aitcg/Editor/Canvas/Tracker/Resize.js')?>"></script>
  305. <script type="text/javascript" src="<?php echo $this->getJsUrl('aitoc/aitcg/Aitcg/Editor/Canvas/Tracker/Rotate.js')?>"></script>
  306. <script type="text/javascript" src="<?php echo $this->getJsUrl('aitoc/aitcg/Aitcg/Editor/Canvas/Tracker/Symbol/Abstract.js')?>"></script>
  307. <script type="text/javascript" src="<?php echo $this->getJsUrl('aitoc/aitcg/Aitcg/Editor/Canvas/Tracker/Delete.js')?>"></script>
  308. <script type="text/javascript" src="<?php echo $this->getJsUrl('aitoc/aitcg/Aitcg/Editor/Canvas/Tracker/ToFront.js')?>"></script>
  309. <script type="text/javascript" src="<?php echo $this->getJsUrl('aitoc/aitcg/Aitcg/Editor/Canvas/Tracker/ToBack.js')?>"></script>
  310. <script type="text/javascript" src="<?php echo $this->getJsUrl('aitoc/aitcg/Aitcg/Editor/Canvas/Tracker/OpacityInc.js')?>"></script>
  311. <script type="text/javascript" src="<?php echo $this->getJsUrl('aitoc/aitcg/Aitcg/Editor/Canvas/Tracker/OpacityDec.js')?>"></script>
  312. <script type="text/javascript" src="<?php echo $this->getJsUrl('aitoc/aitcg/Aitcg/Editor/Canvas/Tracker/Debug.js')?>"></script>
  313. <script type="text/javascript" src="<?php echo $this->getJsUrl('aitoc/aitcg/Aitcg/Editor.js')?>"></script>
  314. <script type="text/javascript" src="<?php echo $this->getJsUrl('aitoc/aitcg/Aitcg/Editor/Tools.js')?>"></script>
  315. <script type="text/javascript" src="<?php echo $this->getJsUrl('aitoc/aitcg/Aitcg/Editor/Tool/Abstract.js')?>"></script>
  316. <script type="text/javascript" src="<?php echo $this->getJsUrl('aitoc/aitcg/Aitcg/Editor/Tool/PredefinedImage.js')?>"></script>
  317. <script type="text/javascript" src="<?php echo $this->getJsUrl('aitoc/aitcg/Aitcg/Editor/Tool/UserImage.js')?>"></script>
  318. <script type="text/javascript" src="<?php echo $this->getJsUrl('aitoc/aitcg/Aitcg/Editor/Tool/CategoryPreview.js')?>"></script>
  319. <script type="text/javascript" src="<?php echo $this->getJsUrl('aitoc/aitcg/Aitcg/Editor/Tool/Mask.js')?>"></script>
  320. <script type="text/javascript" src="<?php echo $this->getJsUrl('aitoc/aitcg/Aitcg/Editor/Tool/Social.js')?>"></script>
  321. <script type="text/javascript" src="<?php echo $this->getJsUrl('aitoc/aitcg/Aitcg/Editor/Tool/Save.js')?>"></script>
  322. <script type="text/javascript" src="<?php echo $this->getJsUrl('aitoc/aitcg/Aitcg/Editor/Tool/Text.js')?>"></script>
  323. <script type="text/javascript" src="<?php echo $this->getJsUrl('aitoc/aitcg/Aitcg/Popup.js')?>"></script>
  324. <script type="text/javascript" src="<?php echo $this->getJsUrl('aitoc/aitcg/Aitcg/AreaEditor.js')?>"></script>
  325. <script type="text/javascript" src="<?php echo $this->getJsUrl('aitoc/aitcg/raphael.js')?>"></script>
  326. <script type="text/javascript" src="<?php echo $this->getJsUrl('aitoc/aitcg/jscolor/jscolor.js')?>"></script>
  327. <script type="text/javascript" src="<?php echo $this->getJsUrl('aitoc/aitcg/rgbcolor.js')?>"></script>
  328. <script type="text/javascript" src="<?php echo $this->getJsUrl('aitoc/aitcg/canvg.js')?>"></script>
  329.  
  330.  
  331. <?php } ?>
Add Comment
Please, Sign In to add comment