AlkantarClanX12
Current Path : /home/thanudqk/siamfreetour.com/wp-content/plugins/hd-quiz/includes/js/ |
Current File : /home/thanudqk/siamfreetour.com/wp-content/plugins/hd-quiz/includes/js/hdq_block.js |
// hd quiz gutenberg block !function(e){function t(r){if(n[r])return n[r].exports;var i=n[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,t),i.l=!0,i.exports}var n={};t.m=e,t.c=n,t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:r})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=0)}([function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(1);n.n(r)},function(e,t){var n=wp.i18n.__,r=wp.blocks.registerBlockType,i=wp.components.SelectControl,u={backgroundColor:"#2d2d2d",color:"#fff",padding:"12px",textAlign:"center"},l=[],o=!1;jQuery.ajax({type:"POST",data:{action:"hdq_get_quiz_list"},url:ajaxurl,success:function(e){l=e,l=JSON.parse(l);var t={value:0,label:" -- "};l.unshift(t)}}),r("hdq/quiz-block",{title:n("HD Quiz"),icon:"clipboard",category:"common",keywords:[n("quiz"),n("hdquiz"),n("HD")],attributes:{quizId:{type:"string",selector:".hdq-quiz-id"}},multiple:!1,reusable:!1,edit:function(e){function t(t){e.setAttributes({quizId:t})}var n=e.attributes.quizId;return!o&&e.isSelected&&(o=!0,setTimeout(function(){jQuery(".hdq_gutenberg_block").val(n)},200)),[wp.element.createElement("div",{style:u},"HD Quiz: This block will be replaced with the selected quiz",wp.element.createElement(i,{class:"hdq_gutenberg_block",onChange:t,value:e.attributes.QuizId,label:"Select a quiz",options:l}))]},save:function(e){return wp.element.createElement("div",{className:"hdq-quiz-gutenberg"},"[HDquiz quiz = "+e.attributes.quizId+"]")}})}]);