Guest User

jsssssss

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