Guest User

js_styles1

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