diff --git a/.gitignore b/.gitignore index 084ddd26a0..32acab88b0 100644 --- a/.gitignore +++ b/.gitignore @@ -13,3 +13,6 @@ npm-debug.log temp .idea wysija-newsletters.zip +tests/javascript/testBundles +assets/css/*.css +assets/js/*.js \ No newline at end of file diff --git a/RoboFile.php b/RoboFile.php index 5d2aecc9f2..7076d404c4 100644 --- a/RoboFile.php +++ b/RoboFile.php @@ -1,6 +1,17 @@ _exec('./composer.phar install'); $this->_exec('npm install'); @@ -13,35 +24,35 @@ class RoboFile extends \Robo\Tasks { } function watch() { - $css_files = array( - 'assets/css/src/admin.styl', - 'assets/css/src/rtl.styl' - ); - - $js_files = glob('assets/js/src/*.js'); + $js_files = array(); + array_map(function($path) use(&$js_files) { + $js_files = array_merge($js_files, glob($path)); + }, $this->js_files); $this->taskWatch() ->monitor($js_files, function() { - $this->compileJavascript(); + $this->compileJs(); }) - ->monitor($css_files, function() use($css_files) { - $this->compileStyles($css_files); + ->monitor($this->css_files, function() { + $this->compileCss(); }) ->run(); } - function compileJavascript() { + function compileAll() { + $this->compileJs(); + $this->compileCss(); + } + + function compileJs() { $this->_exec('./node_modules/webpack/bin/webpack.js'); } - protected function compileStyles($files = array()) { - if(empty($files)) { return; } - + function compileCss() { $this->_exec(join(' ', array( './node_modules/stylus/bin/stylus', '-u nib', - '-w', - join(' ', $files), + join(' ', $this->css_files), '-o assets/css/' ))); } @@ -78,7 +89,7 @@ class RoboFile extends \Robo\Tasks { } function testJavascript() { - $this->compileJavascript(); + $this->compileJs(); $this->_exec(join(' ', array( './node_modules/mocha/bin/mocha', diff --git a/assets/css/admin.css b/assets/css/admin.css deleted file mode 100644 index 606fb73e68..0000000000 --- a/assets/css/admin.css +++ /dev/null @@ -1,1026 +0,0 @@ -.clearfix { - zoom: 1; -} -.clearfix:before, -.clearfix:after { - content: ""; - display: table; -} -.clearfix:after { - clear: both; -} -a:focus { - outline: 0 none !important; -} -body.mailpoet_modal_opened { - overflow: hidden; -} -#mailpoet_modal_overlay { - height: 100%; - left: 0; - overflow-y: auto; - overflow-x: hidden; - position: fixed; - top: 0; - width: 100%; - z-index: 100000; - background-color: rgba(0,0,0,0.6); -} -.mailpoet_modal_highlight { - pointer-events: none; - background-color: #f1f1f1; - position: relative; - z-index: 100001 !important; - -webkit-box-shadow: 0px 0px 20px 2px rgba(255,255,255,0.75); - box-shadow: 0px 0px 20px 2px rgba(255,255,255,0.75); -} -#mailpoet_modal_overlay.mailpoet_overlay_hidden { - background-color: transparent; -} -#mailpoet_modal_overlay.mailpoet_overlay_loading { - background-color: rgba(0,0,0,0.6) !important; - display: block !important; -} -.mailpoet_modal_opened #mailpoet_modal_overlay { - display: block; -} -#mailpoet_popup { - display: none; - position: absolute; - z-index: 25; - top: 48px; - padding-bottom: 48px; - margin: 0; -} -.mailpoet_popup_wrapper { - background-color: #f0f0f0; - overflow: hidden; - position: relative; - width: 100%; - z-index: 0; -} -.mailpoet_overlay_hidden .mailpoet_popup_wrapper { - border: 1px solid #333; -} -#mailpoet_popup_title { - background-color: #222; - border: 1px solid #333; - height: 27px; - margin: 0; - padding: 0 30px 0 0; -} -#mailpoet_popup_title h2 { - color: #cfcfcf; - font-size: 12px; - font-weight: normal; - margin: 6px 0 0 10px; - padding: 0; - font-family: "Lucida Grande", Verdana, Arial, sans-serif; -} -.mailpoet_popup_body { - padding: 10px 10px 10px 10px; -} -#mailpoet_modal_overlay.mailpoet_panel_overlay { - top: 32px; - overflow: hidden; -} -#mailpoet_panel { - display: none; - position: fixed; - z-index: 100002; - top: 0; - bottom: 0; - padding: 0; - margin: 0; - width: 100%; - -webkit-transition: margin 0.3s ease-out; - -moz-transition: margin 0.3s ease-out; - -o-transition: margin 0.3s ease-out; - -ms-transition: margin 0.3s ease-out; - transition: margin 0.3s ease-out; -} -.mailpoet_panel_wrapper { - background-color: #f1f1f1; - border: 1px solid #e1e1e1; - border-top: 0 none; - height: 100%; - overflow-y: auto; - overflow-x: hidden; - width: 100%; - top: 0; - z-index: 0; -} -#mailpoet_panel_title { - margin: 0; - padding: 0; - position: relative; - height: 0; -} -#mailpoet_panel_title h2 { - color: #cfcfcf; - background-color: #222; - border-left: 1px solid #444; - border-right: 1px solid #444; - font-size: 1em; - font-weight: normal; - margin: 0; - padding: 0 30px 0 10px; - font-family: "Lucida Grande", Verdana, Arial, sans-serif; - line-height: 32px; -} -.mailpoet_panel_body { - padding: 10px 10px 36px 10px; -} -#mailpoet_modal_close { - background: url("../img/modal_close_button.png") 7px 7px no-repeat; - height: 30px; - overflow: hidden; - padding: 0; - position: absolute; - width: 30px; - z-index: 2; - outline: 0 none; -} -#mailpoet_popup #mailpoet_modal_close { - right: 0; - top: 0; -} -#mailpoet_panel #mailpoet_modal_close { - right: 10px; - top: 7px; -} -#mailpoet_modal_close:focus { - outline: 0 none; -} -.mailpoet_align_left { - margin: 0; - text-align: left; -} -.mailpoet_align_center { - margin: 0; - text-align: center; -} -.mailpoet_align_right { - margin: 0; - text-align: right; -} -.mailpoet_button { - padding: 3px 15px; - border: 1px solid #444; - font-weight: normal; - cursor: pointer; - background-color: #222; - color: #cfcfcf; - font-size: 1em; -} -.mailpoet_button:hover { - background-color: #0ac; - color: #fff; -} -.mailpoet_button:active { - background-color: #0cf; - color: #fff; -} -.mailpoet_success, -.mailpoet_error { - display: none; -} -.mailpoet_success { - color: #090; -} -.mailpoet_error { - color: #900; -} -@media screen and (max-width: 782px) { - #mailpoet_modal_overlay.mailpoet_panel_overlay { - top: 46px; - } - .mailpoet_panel_body { - padding-bottom: 52px; - } -} -#mailpoet_loading { - width: 150px; - height: 32px; - position: relative; - left: 50%; - top: 50%; - margin-left: -75px; - margin-top: -16px; -} -.mailpoet_modal_loading { - -webkit-animation-direction: linear; - -moz-animation-direction: linear; - -o-animation-direction: linear; - -ms-animation-direction: linear; - animation-direction: linear; - -webkit-animation-duration: 1.95s; - -moz-animation-duration: 1.95s; - -o-animation-duration: 1.95s; - -ms-animation-duration: 1.95s; - animation-duration: 1.95s; - -webkit-animation-iteration-count: infinite; - -moz-animation-iteration-count: infinite; - -o-animation-iteration-count: infinite; - -ms-animation-iteration-count: infinite; - animation-iteration-count: infinite; - -webkit-animation-name: bounce_mailpoet_modal_loading; - -moz-animation-name: bounce_mailpoet_modal_loading; - -o-animation-name: bounce_mailpoet_modal_loading; - -ms-animation-name: bounce_mailpoet_modal_loading; - animation-name: bounce_mailpoet_modal_loading; - -webkit-border-radius: 21px; - border-radius: 21px; - background-color: #e01d4e; - float: left; - height: 32px; - margin-left: 17px; - width: 32px; -} -#mailpoet_modal_loading_1 { - -webkit-animation-delay: 0.39s; - -moz-animation-delay: 0.39s; - -o-animation-delay: 0.39s; - -ms-animation-delay: 0.39s; - animation-delay: 0.39s; -} -#mailpoet_modal_loading_2 { - -webkit-animation-delay: 0.91s; - -moz-animation-delay: 0.91s; - -o-animation-delay: 0.91s; - -ms-animation-delay: 0.91s; - animation-delay: 0.91s; -} -#mailpoet_modal_loading_3 { - -webkit-animation-delay: 1.17s; - -moz-animation-delay: 1.17s; - -o-animation-delay: 1.17s; - -ms-animation-delay: 1.17s; - animation-delay: 1.17s; -} -@-moz-keyframes bounce_mailpoet_modal_loading { - 0%, 50% { - background-color: #064e6d; - } -} -@-webkit-keyframes bounce_mailpoet_modal_loading { - 0%, 50% { - background-color: #064e6d; - } -} -@-o-keyframes bounce_mailpoet_modal_loading { - 0%, 50% { - background-color: #064e6d; - } -} -@keyframes bounce_mailpoet_modal_loading { - 0%, 50% { - background-color: #064e6d; - } -} -.mailpoet_notice { - position: relative; -} -.mailpoet_notice_close { - position: absolute; - right: 0.5em; - top: 0.5em; - color: #999; - text-decoration: none; -} -.formError { - z-index: 990; -} -.formError .formErrorContent { - z-index: 991; -} -.formError .formErrorArrow { - z-index: 996; -} -.ui-dialog .formError { - z-index: 5000; -} -.ui-dialog .formError .formErrorContent { - z-index: 5001; -} -.ui-dialog .formError .formErrorArrow { - z-index: 5006; -} -.inputContainer { - position: relative; - float: left; -} -.formError { - position: absolute; - top: 300px; - left: 300px; - display: block; - cursor: pointer; - text-align: left; -} -.formError.inline { - position: relative; - top: 0; - left: 0; - display: inline-block; -} -.ajaxSubmit { - padding: 20px; - background: #55ea55; - border: 1px solid #999; - display: none; -} -.formError .formErrorContent { - width: 100%; - background: #00579a; - position: relative; - color: #fff; - min-width: 120px; - font-size: 12px; - border: 1px solid #fff; - -webkit-box-shadow: 0 0 2px #333; - box-shadow: 0 0 2px #333; - -moz-box-shadow: 0 0 2px #333; - -webkit-box-shadow: 0 0 2px #333; - -o-box-shadow: 0 0 2px #333; - padding: 4px 10px 4px 10px; - -webkit-border-radius: 0; - border-radius: 0; - -moz-border-radius: 0; - -webkit-border-radius: 0; - -o-border-radius: 0; -} -.formError.inline .formErrorContent { - -webkit-box-shadow: none; - box-shadow: none; - -moz-box-shadow: none; - -webkit-box-shadow: none; - -o-box-shadow: none; - border: none; - -webkit-border-radius: 0; - border-radius: 0; - -moz-border-radius: 0; - -webkit-border-radius: 0; - -o-border-radius: 0; -} -.greenPopup .formErrorContent { - background: #33be40; -} -.blackPopup .formErrorContent { - background: #393939; - color: #fff; -} -.formError .formErrorArrow { - width: 15px; - margin: -2px 0 0 13px; - position: relative; -} -body[dir='rtl'] .formError .formErrorArrow, -body.rtl .formError .formErrorArrow { - margin: -2px 13px 0 0; -} -.formError .formErrorArrowBottom { - -webkit-box-shadow: none; - box-shadow: none; - -moz-box-shadow: none; - -webkit-box-shadow: none; - -o-box-shadow: none; - margin: 0px 0 0 12px; - top: 2px; -} -.formError .formErrorArrow div { - border-left: 1px solid #fff; - border-right: 1px solid #fff; - -webkit-box-shadow: 0 1px 1px #474747; - box-shadow: 0 1px 1px #474747; - -moz-box-shadow: 0 1px 1px #474747; - -webkit-box-shadow: 0 1px 1px #474747; - -o-box-shadow: 0 1px 1px #474747; - font-size: 0px; - height: 1px; - background: #00579a; - margin: 0 auto; - line-height: 0; - font-size: 0; - display: block; -} -.formError .formErrorArrowBottom div { - -webkit-box-shadow: none; - box-shadow: none; - -moz-box-shadow: none; - -webkit-box-shadow: none; - -o-box-shadow: none; -} -.greenPopup .formErrorArrow div { - background: #33be40; -} -.blackPopup .formErrorArrow div { - background: #393939; - color: #fff; -} -.formError .formErrorArrow .line10 { - width: 13px; - border: none; -} -.formError .formErrorArrow .line9 { - width: 11px; - border: none; -} -.formError .formErrorArrow .line8 { - width: 11px; -} -.formError .formErrorArrow .line7 { - width: 9px; -} -.formError .formErrorArrow .line6 { - width: 7px; -} -.formError .formErrorArrow .line5 { - width: 5px; -} -.formError .formErrorArrow .line4 { - width: 3px; -} -.formError .formErrorArrow .line3 { - width: 1px; - border-left: 1px solid #fff; - border-right: 1px solid #fff; - border-bottom: 0 solid #fff; -} -.formError .formErrorArrow .line2 { - width: 3px; - border: none; - background: #fff; -} -.formError .formErrorArrow .line1 { - width: 1px; - border: none; - background: #fff; -} -#mailpoet_form_history { - display: none; -} -#mailpoet_form_editor { - padding: 20px; - width: 300px; - border: 1px solid #ccc; - position: relative; - background-color: #fff; - -webkit-box-shadow: 0 0 5px rgba(0,0,0,0.2) inset 0 0 20px rgba(0,0,0,0.1); - box-shadow: 0 0 5px rgba(0,0,0,0.2) inset 0 0 20px rgba(0,0,0,0.1); -} -#mailpoet_form_editor:before, -#mailpoet_form_editor:after { - position: absolute; - width: 40%; - height: 10px; - content: ' '; - left: 12px; - bottom: 12px; - background: transparent; - -webkit-transform: skew(-5deg) rotate(-5deg); - -moz-transform: skew(-5deg) rotate(-5deg); - -ms-transform: skew(-5deg) rotate(-5deg); - -o-transform: skew(-5deg) rotate(-5deg); - -webkit-transform: skew(-5deg) rotate(-5deg); - -moz-transform: skew(-5deg) rotate(-5deg); - -o-transform: skew(-5deg) rotate(-5deg); - -ms-transform: skew(-5deg) rotate(-5deg); - transform: skew(-5deg) rotate(-5deg); -rgba(0,0,0,0.3) -rgba(0,0,0,0.3) - -webkit-box-shadow: 0 6px 12px rgba(0,0,0,0.3); - box-shadow: 0 6px 12px rgba(0,0,0,0.3); - z-index: -1; -} -#mailpoet_form_editor:after { - left: auto; - right: 12px; - -webkit-transform: skew(5deg) rotate(5deg); - -moz-transform: skew(5deg) rotate(5deg); - -ms-transform: skew(5deg) rotate(5deg); - -o-transform: skew(5deg) rotate(5deg); - -webkit-transform: skew(5deg) rotate(5deg); - -moz-transform: skew(5deg) rotate(5deg); - -o-transform: skew(5deg) rotate(5deg); - -ms-transform: skew(5deg) rotate(5deg); - transform: skew(5deg) rotate(5deg); -} -.mailpoet_warning { - font-weight: bold; - color: #900; -} -.block_placeholder { - font-weight: bold; - height: 0; - overflow: hidden; - line-height: 30px; - text-align: center; - border: 0 none; - width: 298px; - z-index: 9500; - margin: 0 auto; - text-indent: -9999px; -} -.block_placeholder.active { - text-indent: 0; -/*border:1px dashed #dfdfdf;*/ -/*background-color:#f5f5f5;*/ - background-color: #4cb7e1; - display: block; - overflow: auto; - height: 30px; -} -.block_placeholder.hover { - background-color: #0074a2; - border-color: #0074a2; - color: #fff; -} -.mailpoet_form_block { - background-color: #fff; - height: 20px; - border: 0 none; -} -.mailpoet_form_block.highlighted { - border: 1px solid #5897fb; - padding: 9px 17px; -} -.mailpoet_form_block img { - max-width: 100%; -} -.mailpoet_form_block p { - margin: 5px 0; - word-wrap: break-word; -} -.mailpoet_radio, -.mailpoet_checkbox { - margin: -2px 5px 0 0; -} -#mailpoet_form_wrapper { - position: relative; -} -#mailpoet_form_container { - width: 340px; - margin: 0; -} -#mailpoet_form_editor.loading, -#mailpoet_form_toolbar.loading { - background: url("loading.gif") no-repeat center center #fcfcfc; -} -#mailpoet_form_toolbar.loading { - border: 1px solid #dfdfdf; -} -#mailpoet_form_toolbar.loading #mailpoet_toolbar_fields { - visibility: hidden; - z-index: 1; -} -#wysija-add-field { - float: none; -} -#mailpoet_form_toolbar { - position: absolute; - width: 400px; -} -#mailpoet_form_toolbar .mailpoet_form_toolbar_tabs { - border-bottom: 1px solid #dfdfdf; - line-height: 0; -} -#mailpoet_form_toolbar .add_custom_field { - text-align: center; - padding: 15px 0 5px 0; -} -#mailpoet_form_toolbar .mailpoet_form_toolbar_tabs li, -#mailpoet_form_toolbar .mailpoet_form_toolbar_tabs a { - margin: 0; - height: 30px; - line-height: 30px; - padding: 0; - display: -moz-inline-box; - display: inline-block; - *display: inline; - *float: left; - outline: 0 none; -} -#mailpoet_form_toolbar .mailpoet_form_toolbar_tabs a { - outline: 0 none; - text-decoration: none; - color: #a6a6a6; -} -#mailpoet_form_toolbar .mailpoet_form_toolbar_tabs li { - margin: 0 0 1px 0; -} -#mailpoet_form_toolbar .mailpoet_form_toolbar_tabs a { - font-family: Georgia, "Times New Roman", "Bitstream Charter", Times, serif; - background-color: #f5f5f5; - background: -webkit-linear-gradient(center top, #f9f9f9, #f5f5f5); - background: -moz-linear-gradient(center top, #f9f9f9, #f5f5f5); - background: -o-linear-gradient(center top, #f9f9f9, #f5f5f5); - background: -ms-linear-gradient(center top, #f9f9f9, #f5f5f5); - background: linear-gradient(center top, #f9f9f9, #f5f5f5); - border: 1px solid #dfdfdf; - -webkit-border-radius: 3px 3px 0 0; - border-radius: 3px 3px 0 0; - -webkit-box-shadow: 0 1px 0 #fff inset; - box-shadow: 0 1px 0 #fff inset; - padding: 0 7px; -} -#mailpoet_form_toolbar .mailpoet_form_toolbar_tabs a:hover { - background-color: #eee; -} -#mailpoet_form_toolbar .mailpoet_form_toolbar_tabs a.selected { - color: #000; - border-bottom: 0 none; - background: #fcfcfc; - filter: none; - padding-bottom: 1px; -} -#mailpoet_form_toolbar .mailpoet_form_toolbar_tabs .last a, -.wysija_params { - display: none !important; -} -#mailpoet_form_toolbar .mailpoet_form_toolbar_tabs, -#mailpoet_form_toolbar #mailpoet_toolbar_fields { - position: relative; - z-index: 9998; - margin: 0; -} -h2.title { - margin: 0 0 15px 0; -} -#mailpoet_form_name_input { - vertical-align: bottom; -} -.mailpoet_form_widget { - width: 298px; - height: 25px; - line-height: 25px; - z-index: 9999 !important; -} -.mailpoet_toolbar_section { - margin-bottom: 0; - background: none repeat scroll 0 0 #fff; - border: 1px solid #e5e5e5; - -webkit-box-shadow: 0 1px 1px rgba(0,0,0,0.04); - box-shadow: 0 1px 1px rgba(0,0,0,0.04); - min-width: 255px; - position: relative; - cursor: pointer; - overflow: hidden; - max-height: 1000px; - -webkit-transition: max-height 0.5s ease-in-out; - -moz-transition: max-height 0.5s ease-in-out; - -o-transition: max-height 0.5s ease-in-out; - -ms-transition: max-height 0.5s ease-in-out; - transition: max-height 0.5s ease-in-out; -} -.mailpoet_toolbar_section > div { - padding: 10px 20px 20px 20px; - overflow: auto; - height: 100%; - min-width: 255px; -} -.mailpoet_toolbar_section h3 { - margin: 10px; - position: relative; -} -.mailpoet_toolbar_section.closed { - max-height: 38px; -} -.mailpoet_toolbar_section .mailpoet_toggle { - position: absolute; - top: 0; - right: 0; - height: 38px; - width: 27px; -} -.mailpoet_toolbar_section .mailpoet_toggle:focus { - outline: 0 none !important; - -webkit-box-shadow: none !important; - box-shadow: none !important; -} -.mailpoet_toolbar_section .mailpoet_toggle:before { - right: 12px; - font: 400 20px/1 dashicons; - speak: none; - display: inline-block; - padding: 8px 10px; - top: 0; - position: relative; - -webkit-font-smoothing: antialiased; - -moz-osx-font-smoothing: grayscale; - text-decoration: none !important; - content: '\f142'; -} -.mailpoet_toolbar_section.closed .mailpoet_toggle:before { - content: '\f140'; -} -#mailpoet_form_styles { - margin: 10px; - max-width: 318px; - width: 318px; - min-height: 300px; - resize: vertical; -} -#mailpoet_form_toolbar a.mailpoet_form_field, -.mailpoet_form_widget { - height: 25px; - line-height: 25px; - background-color: #f5f5f5; - background: -webkit-linear-gradient(center top, #f9f9f9, #ececec); - background: -moz-linear-gradient(center top, #f9f9f9, #ececec); - background: -o-linear-gradient(center top, #f9f9f9, #ececec); - background: -ms-linear-gradient(center top, #f9f9f9, #ececec); - background: linear-gradient(center top, #f9f9f9, #ececec); - border: 1px solid #dfdfdf; - -webkit-border-radius: 3px; - border-radius: 3px; - -webkit-box-shadow: 0 1px 0 #fff inset; - box-shadow: 0 1px 0 #fff inset; - display: block; - font-size: 12px; - font-weight: bold; - padding: 0 7px; - cursor: move; - color: #222; - text-shadow: 0 1px 0 #fff; -} -#mailpoet_form_toolbar a.mailpoet_form_field.disabled { - cursor: pointer; - color: #ccc; - pointer-events: none; -} -.mailpoet_form_field_edit { - position: absolute; - right: 27px; - bottom: 13px; -} -.mailpoet_form_field_delete { - position: absolute; - right: 7px; - bottom: 13px; -} -#mailpoet_toolbar_fields li { - padding: 0 0 10px 0; - position: relative; -} -#mailpoet_toolbar_fields li.notice { - font-style: italic; - font-size: 11px; - margin: 0 !important; - border: 0 none !important; - background: none !important; -} -.mailpoet_form_block { - position: relative; - margin: 0; - padding: 10px 18px 10px 18px; - display: inline-table; - display: block; - height: 1%; - margin: 0; - z-index: 98; -} -.mailpoet_form_block.dragging { - z-index: 99000; - pointer-events: none; -} -.mailpoet_form_block:after { - content: "."; - display: block; - height: 0; - clear: both; - visibility: hidden; -} -.mailpoet_form_block.hover { - border: 1px dashed #bbb; - margin: 0 0 0 0; - padding: 9px 17px 9px 17px; -} -.mailpoet_form_block.static { -/*padding:0; - margin:0;*/ - background-color: #999; -} -.mailpoet_form_block .wysija_controls { - background-color: #dfdfdf; - background: -webkit-linear-gradient(center top, #eee, #bbb); - background: -moz-linear-gradient(center top, #eee, #bbb); - background: -o-linear-gradient(center top, #eee, #bbb); - background: -ms-linear-gradient(center top, #eee, #bbb); - background: linear-gradient(center top, #eee, #bbb); - -webkit-border-radius: 2px; - border-radius: 2px; - border: 1px solid #ccc; - position: absolute; - margin: 0; - padding: 0; - width: 298px; - height: 20px; - left: -1px; - right: 0; - top: -22px; -} -.mailpoet_form_block .wysija_controls li { - float: left; - width: 20px; - height: 20px; -} -.mailpoet_form_block .wysija_controls a { - cursor: pointer; - float: left; - font-size: 120%; - font-weight: bold; - height: 20px; - line-height: 20px; - text-align: center; - width: 20px; - color: #000; -} -.mailpoet_form_block .wysija_controls a.remove { - margin: 0 0 0 1px; -} -.mailpoet_form_block .handle_container, -.mailpoet_form_block .handle_container a { - float: none; - width: 40px !important; -} -.mailpoet_form_block .handle_container { - left: 140px; - top: 0; - position: absolute; -} -.wysija_controls a span, -.wysija_gallery .wysija_tools a span, -.wysija_image .wysija_tools a span, -.wysija_text .wysija_tools a span, -#mailpoet_toolbar_fields a span { - display: block; - height: 20px; - width: 20px; -} -.wysija_controls span input { - margin: 2px 0 0 0; - padding: 0; - color: transparent; -} -.alignment-left span { - background: url("../img/form_editor_icons.png") no-repeat 0 0; -} -.alignment-left.active span, -.alignment-left:hover span { - background: url("../img/form_editor_icons.png") no-repeat 0 -20px; -} -.alignment-center span { - background: url("../img/form_editor_icons.png") no-repeat -20px 0; -} -.alignment-center.active span, -.alignment-center:hover span { - background: url("../img/form_editor_icons.png") no-repeat -20px -20px; -} -.alignment-right span { - background: url("../img/form_editor_icons.png") no-repeat -40px 0; -} -.alignment-right.active span, -.alignment-right:hover span { - background: url("../img/form_editor_icons.png") no-repeat -40px -20px; -} -.add-link span { - background: url("../img/form_editor_icons.png") no-repeat -60px 0; -} -.add-link.active span, -.add-link:hover span { - background: url("../img/form_editor_icons.png") no-repeat -60px -20px; -} -.remove-link span { - background: url("../img/form_editor_icons.png") no-repeat -80px 0; -} -.remove-link.active span, -.remove-link:hover span { - background: url("../img/form_editor_icons.png") no-repeat -80px -20px; -} -.remove span, -.delete span { - background: url("../img/form_editor_icons.png") no-repeat -100px 0; -} -.remove.active span, -.remove:hover span, -.delete.active span, -.delete:hover span { - background: url("../img/form_editor_icons.png") no-repeat -100px -20px; -} -.handle span { - background: url("../img/handle.png") no-repeat; - cursor: move; - width: 40px !important; -} -.duplicate span { - background: url("../img/form_editor_icons.png") no-repeat -140px 0; -} -.duplicate.active span, -.duplicate:hover span { - background: url("../img/form_editor_icons.png") no-repeat -140px -20px; -} -.settings span { - background: url("../img/form_editor_icons.png") no-repeat -160px 0; -} -.settings.active span, -.settings:hover span { - background: url("../img/form_editor_icons.png") no-repeat -160px -20px; -} -.icon-plus span { - background: url("../img/form_editor_icons.png") no-repeat -200px 0; -} -.icon-plus.active span, -.icon-plus:hover span { - background: url("../img/form_editor_icons.png") no-repeat -200px -20px; -} -.icon-minus span { - background: url("../img/form_editor_icons.png") no-repeat -220px 0; -} -.icon-minus.active span, -.icon-minus:hover span { - background: url("../img/form_editor_icons.png") no-repeat -220px -20px; -} -.wysija_options { - display: none; -} -.wysija_settings { - position: absolute; - z-index: 1000; -} -.wysija_settings a { - background-color: #f5f5f5; - background: -webkit-linear-gradient(center top, #f9f9f9, #ececec); - background: -moz-linear-gradient(center top, #f9f9f9, #ececec); - background: -o-linear-gradient(center top, #f9f9f9, #ececec); - background: -ms-linear-gradient(center top, #f9f9f9, #ececec); - background: linear-gradient(center top, #f9f9f9, #ececec); - border: 1px solid #dfdfdf; - -webkit-border-radius: 3px; - border-radius: 3px; - -webkit-box-shadow: 0 1px 0 #fff inset; - box-shadow: 0 1px 0 #fff inset; - font-size: 12px; - font-weight: normal; - cursor: pointer; - color: #222; - text-shadow: 0 1px 0 #fff; - text-decoration: none; - display: block; - padding: 5px 5px 3px 27px; -} -.wysija_settings a span { - width: 20px; - height: 20px; - position: absolute; - top: 3px; - left: 5px; -} -.mailpoet_form_block label { - margin: 0 5px 0 0; - display: block; -} -#mailpoet_on_success textarea, -#mailpoet_on_success select { - width: 100%; -} -#mailpoet_on_success textarea { - height: 50px; - min-height: 50px; - resize: vertical; -} -.mailpoet_form_block textarea { - resize: none; -} -.mailpoet_form_block input, -.mailpoet_form_block textarea { - pointer-events: none; -} -#mailpoet_form_export textarea { - width: 340px; - height: 150px; - min-height: 150px; - resize: vertical; - font-size: 85%; - display: none; -} -.mailpoet_form_field_edit, -.mailpoet_form_field_delete { - text-decoration: none; -} -.mailpoet_form_field_edit:hover .dashicons-admin-generic:before, -.mailpoet_form_field_delete:hover .dashicons-dismiss:before, -.settings:hover .dashicons-admin-generic:before { - color: #2ea2cc; -} -.mailpoet_form_field_edit span, -.mailpoet_form_field_delete span { - background: none !important; - color: #999; -} -.mailpoet_form_field_delete span:before { - font-size: 21px; -} -.CodeMirror { - border: 1px solid #eee; -} diff --git a/assets/css/form_editor.css b/assets/css/form_editor.css deleted file mode 100644 index bda49f4f9d..0000000000 --- a/assets/css/form_editor.css +++ /dev/null @@ -1,629 +0,0 @@ -a:focus { - outline: 0 none !important; -} -#mailpoet_form_history { - display:none; -} -#mailpoet_form_editor { - padding:20px; - width:300px; - border:1px solid #ccc; - position: relative; - background-color: #fff; - -webkit-box-shadow: 0 0 4px rgba(0, 0, 0, 0.2), inset 0 0 20px rgba(0, 0, 0, 0.1); - -moz-box-shadow: 0 0 4px rgba(0, 0, 0, 0.2), inset 0 0 20px rgba(0, 0, 0, 0.1); - box-shadow: 0 0 5px rgba(0, 0, 0, 0.2), inset 0 0 20px rgba(0, 0, 0, 0.1); -} - -#mailpoet_form_editor:before, #mailpoet_form_editor:after { - position: absolute; - width: 40%; - height: 10px; - content: ' '; - left: 12px; - bottom: 12px; - background: transparent; - -webkit-transform: skew(-5deg) rotate(-5deg); - -moz-transform: skew(-5deg) rotate(-5deg); - -ms-transform: skew(-5deg) rotate(-5deg); - -o-transform: skew(-5deg) rotate(-5deg); - transform: skew(-5deg) rotate(-5deg); - -webkit-box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3); - -moz-box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3); - box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3); - z-index: -1; -} -#mailpoet_form_editor:after -{ - left: auto; - right: 12px; - -webkit-transform: skew(5deg) rotate(5deg); - -moz-transform: skew(5deg) rotate(5deg); - -ms-transform: skew(5deg) rotate(5deg); - -o-transform: skew(5deg) rotate(5deg); - transform: skew(5deg) rotate(5deg); -} - - -/* Warnings in blocks*/ -.mailpoet_warning { - font-weight:bold; - color:#900; -} - -.block_placeholder { - font-weight: bold; - height: 0; - overflow: hidden; - line-height: 30px; - text-align: center; - border: 0 none; - width:298px; - z-index: 9500; - margin:0 auto; - text-indent: -9999px; - -} -.block_placeholder.active { - text-indent: 0; - /*border:1px dashed #dfdfdf;*/ - /*background-color:#f5f5f5;*/ - background-color: #4cb7e1; - display:block; - overflow: auto; - height: 30px; -} -.block_placeholder.hover { - background-color: #0074a2; - border-color:#0074a2; - color: #fff; -} - -.mailpoet_form_block { - background-color:#fff; - height:20px; - border:0 none; -} -.mailpoet_form_block.highlighted { - border:1px solid #5897FB; - padding:9px 17px; -} - -.mailpoet_form_block img { - max-width: 100%; -} - -/* Widget styles */ -.mailpoet_form_block p { - margin:5px 0; - word-wrap: break-word; -} - -/* Widget: checkbox, radio */ -.mailpoet_radio, -.mailpoet_checkbox { - margin:-2px 5px 0 0; -} - -/* MailPoet Form wrapper */ -#mailpoet_form_wrapper { - position: relative; -} - -/* MailPoet Form container */ -#mailpoet_form_container { - width:340px; - margin:0; -} -#mailpoet_form_editor.loading, -#mailpoet_form_toolbar.loading { - background: url(loading.gif) no-repeat center center #fcfcfc; -} -#mailpoet_form_toolbar.loading { - border:1px solid #dfdfdf; -} -#mailpoet_form_toolbar.loading #mailpoet_toolbar_fields { - visibility: hidden; - z-index:1; -} - -/* Tabs : content/images/styles/themes */ -#wysija-add-field { - float: none; -} - -#mailpoet_form_toolbar { - position: absolute; - width: 400px; -} -#mailpoet_form_toolbar .mailpoet_form_toolbar_tabs { - border-bottom:1px solid #dfdfdf; - line-height:0; -} -#mailpoet_form_toolbar .add_custom_field { - text-align:center; - padding:15px 0 5px 0; -} - -#mailpoet_form_toolbar .mailpoet_form_toolbar_tabs li, -#mailpoet_form_toolbar .mailpoet_form_toolbar_tabs a { - margin:0; - height:30px; - line-height:30px; - padding:0; - display:-moz-inline-box; - display:inline-block; - *display:inline; - *float:left; - outline:0 none; -} -#mailpoet_form_toolbar .mailpoet_form_toolbar_tabs a { - outline:0 none; text-decoration:none; color:#a6a6a6; -} -#mailpoet_form_toolbar .mailpoet_form_toolbar_tabs li { - margin:0 0 1px 0; -} -#mailpoet_form_toolbar .mailpoet_form_toolbar_tabs a { - font-family:Georgia,"Times New Roman","Bitstream Charter",Times,serif; - background-color: #F5F5F5; - background-image: -moz-linear-gradient(center top , #F9F9F9, #F5F5F5); - filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#F5F5F5', endColorstr='#F9F9F9'); - background: -webkit-gradient(linear, left top,left bottom, from(#F9F9F9), to(#F5F5F5)); - border:1px solid #DFDFDF; - -moz-border-radius: 3px 3px 0 0; - -webkit-border-radius: 3px 3px 0 0; - -khtml-border-radius: 3px 3px 0 0; - border-radius: 3px 3px 0 0; - box-shadow: 0 1px 0 #FFFFFF inset; - padding:0 7px; -} -#mailpoet_form_toolbar .mailpoet_form_toolbar_tabs a:hover { - background-color:#eee; -} -#mailpoet_form_toolbar .mailpoet_form_toolbar_tabs a.selected { - color:#000; - border-bottom:0 none; - background:#fcfcfc; - filter:none; - padding-bottom:1px; -} -#mailpoet_form_toolbar .mailpoet_form_toolbar_tabs .last a { } - -.wysija_params { - display:none !important; -} - -#mailpoet_form_toolbar .mailpoet_form_toolbar_tabs, -#mailpoet_form_toolbar #mailpoet_toolbar_fields { - position:relative; - z-index:9998; - margin:0; -} - -/* edit form name */ -h2.title { - margin:0 0 15px 0; -} - -#mailpoet_form_name_input { - vertical-align: bottom; -} - -/* wysija widgets */ -.mailpoet_form_widget { - width:298px; - height:25px; - line-height:25px; - z-index:9999 !important; -} - -.mailpoet_toolbar_section { - margin-bottom: 0; - - background: none repeat scroll 0 0 #fff; - border: 1px solid #e5e5e5; - box-shadow: 0 1px 1px rgba(0, 0, 0, 0.04); - min-width: 255px; - position: relative; - - cursor: pointer; - max-height: auto; -} - -.mailpoet_toolbar_section > div { - padding:10px 20px 20px 20px; -} - -.mailpoet_toolbar_section h3 { - margin: 10px; - position: relative; -} - -.mailpoet_toolbar_section.closed { - max-height:38px; - overflow: hidden; -} - -.mailpoet_toolbar_section .mailpoet_toggle { - position: absolute; - top:0; - right: 0; - height: 38px; - width: 27px; -} -.mailpoet_toolbar_section .mailpoet_toggle:focus { - outline: 0 none !important; - box-shadow: none !important; -} - -.mailpoet_toolbar_section .mailpoet_toggle:before { - right: 12px; - font: 400 20px/1 dashicons; - speak: none; - display: inline-block; - padding: 8px 10px; - top: 0; - position: relative; - -webkit-font-smoothing: antialiased; - -moz-osx-font-smoothing: grayscale; - text-decoration: none!important; - content: '\f142'; -} -.mailpoet_toolbar_section.closed .mailpoet_toggle:before { - content: '\f140'; -} - -#mailpoet_form_styles { - margin:10px; - max-width: 318px; - width: 318px; - min-height: 300px; - resize:vertical; -} - -#mailpoet_form_toolbar a.mailpoet_form_field, -.mailpoet_form_widget { - height:25px; - line-height:25px; - background-color: #F5F5F5; - background-image: -moz-linear-gradient(center top , #f9f9f9, #ececec); - filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#f9f9f9', endColorstr='#ececec'); - background: -webkit-gradient(linear, left top,left bottom, from(#f9f9f9), to(#ececec)); - border:1px solid #DFDFDF; - -moz-border-radius: 3px; - -webkit-border-radius: 3px; - -khtml-border-radius: 3px; - border-radius: 3px; - box-shadow: 0 1px 0 #FFFFFF inset; - display:block; - font-size: 12px; - font-weight: bold; - padding:0 7px; - cursor:move; - color:#222; - text-shadow: 0 1px 0 #FFFFFF; -} -#mailpoet_form_toolbar a.mailpoet_form_field.disabled { - cursor:pointer; - color:#cccccc; - pointer-events:none; -} -.mailpoet_form_field_edit { - position:absolute; - right:27px; - bottom:13px; -} -.mailpoet_form_field_delete { - position: absolute; - right:7px; - bottom:13px; -} - -/* toolbar: fields */ -#mailpoet_toolbar_fields li { - padding:0 0 10px 0; - position:relative; -} - -#mailpoet_toolbar_fields li.notice { - font-style:italic; - font-size:11px; - margin: 0 !important; - border: 0 none !important; - background: none !important; -} - -/* blocks */ -.mailpoet_form_block { - position:relative; - margin:0; - padding:10px 18px 10px 18px; - display: inline-table; - display: block; - height: 1%; - margin:0; - z-index:98; -} - -.mailpoet_form_block.dragging { - z-index:99000; - pointer-events:none; -} - -.mailpoet_form_block:after { - content: "."; - display: block; - height: 0; - clear: both; - visibility: hidden; -} -.mailpoet_form_block.hover { - border:1px dashed #bbb; - margin:0 0 0 0; - padding:9px 17px 9px 17px; -} -.mailpoet_form_block.static { - /*padding:0; - margin:0;*/ - background-color:#999; -} - -/* controls*/ -.mailpoet_form_block .wysija_controls { - background-color:#dfdfdf; - background-image: -moz-linear-gradient(center bottom , #bbb, #eee); - filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#eeeeee', endColorstr='#bbbbbb'); - background: -webkit-gradient(linear, left bottom,left top, from(#bbb), to(#eee)); - -moz-border-radius: 2px; - -webkit-border-radius: 2px; - -khtml-border-radius: 2px; - border-radius: 2px; - border:1px solid #ccc; - position:absolute; - margin:0; - padding:0; - width:298px; - height:20px; - left:-1px; - right:0; - top:-22px; -} -.mailpoet_form_block .wysija_controls li { - float:left; - width:20px; - height:20px; -} -.mailpoet_form_block .wysija_controls a { - cursor: pointer; - float: left; - font-size: 120%; - font-weight: bold; - height: 20px; - line-height: 20px; - text-align: center; - width: 20px; - color:#000; -} - -.mailpoet_form_block .wysija_controls a.remove { - margin:0 0 0 1px; -} -.mailpoet_form_block .handle_container, -.mailpoet_form_block .handle_container a { - float:none; - width:40px !important; -} - -.mailpoet_form_block .handle_container { - left: 140px; - top: 0; - position: absolute; -} - -/* controls & icons */ -.wysija_controls a span, -.wysija_gallery .wysija_tools a span, -.wysija_image .wysija_tools a span, -.wysija_text .wysija_tools a span, -#mailpoet_toolbar_fields a span { - display: block; - height:20px; - width:20px; -} - -/* toolbar: full width button */ - -/* color picker in control bars */ -.wysija_controls span input { - margin:2px 0 0 0; - padding: 0; - color: transparent; -} - -/* left alignment button */ -.alignment-left span { - background:url(form_editor_icons.png) no-repeat 0 0; -} -.alignment-left.active span, .alignment-left:hover span { - background:url(form_editor_icons.png) no-repeat 0 -20px; -} - -/* center alignment button */ -.alignment-center span { - background:url(form_editor_icons.png) no-repeat -20px 0; -} -.alignment-center.active span, .alignment-center:hover span { - background:url(form_editor_icons.png) no-repeat -20px -20px; -} - -/* right alignment button */ -.alignment-right span { - background:url(form_editor_icons.png) no-repeat -40px 0; -} -.alignment-right.active span, .alignment-right:hover span { - background:url(form_editor_icons.png) no-repeat -40px -20px; -} - -/* linking */ -.add-link span { - background:url(form_editor_icons.png) no-repeat -60px 0; -} -.add-link.active span, .add-link:hover span { - background:url(form_editor_icons.png) no-repeat -60px -20px; -} - -.remove-link span { - background:url(form_editor_icons.png) no-repeat -80px 0; -} - -.remove-link.active span, .remove-link:hover span { - background:url(form_editor_icons.png) no-repeat -80px -20px; -} - -/* block controls */ -.remove span, .delete span { - background:url(form_editor_icons.png) no-repeat -100px 0; -} -.remove.active span, .remove:hover span, -.delete.active span, .delete:hover span { - background:url(form_editor_icons.png) no-repeat -100px -20px; -} - -.handle span { - background: url(handle.png) no-repeat; - cursor:move; - width: 40px !important; -} - -.duplicate span { - background:url(form_editor_icons.png) no-repeat -140px 0; -} - -.duplicate.active span, .duplicate:hover span { - background:url(form_editor_icons.png) no-repeat -140px -20px; -} - -.settings span { - background:url(form_editor_icons.png) no-repeat -160px 0; -} -.settings.active span, .settings:hover span { - background:url(form_editor_icons.png) no-repeat -160px -20px; -} - -.icon-plus span { - background:url(form_editor_icons.png) no-repeat -200px 0; -} - -.icon-plus.active span, .icon-plus:hover span { - background:url(form_editor_icons.png) no-repeat -200px -20px; -} - -.icon-minus span { - background:url(form_editor_icons.png) no-repeat -220px 0; -} - -.icon-minus.active span, .icon-minus:hover span { - background:url(form_editor_icons.png) no-repeat -220px -20px; -} - -/* wysija options */ -.wysija_options { - display:none; -} - -/* wysija block settings */ -.wysija_settings { - position: absolute; - z-index:1000; -} -.wysija_settings a { - background-color: #F5F5F5; - background-image: -moz-linear-gradient(center top , #f9f9f9, #ececec); - filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#f9f9f9', endColorstr='#ececec'); - background: -webkit-gradient(linear, left top,left bottom, from(#f9f9f9), to(#ececec)); - border:1px solid #DFDFDF; - -moz-border-radius: 3px; - -webkit-border-radius: 3px; - -khtml-border-radius: 3px; - border-radius: 3px; - box-shadow: 0 1px 0 #FFFFFF inset; - font-size: 12px; - font-weight: normal; - cursor:pointer; - color:#222; - text-shadow: 0 1px 0 #FFFFFF; - text-decoration: none; - display:block; - padding:5px 5px 3px 27px; -} - -.wysija_settings a span { - width: 20px; - height: 20px; - position: absolute; - top: 3px; - left: 5px; -} - -/* labels */ -.mailpoet_form_block label { - margin:0 5px 0 0; - display:block; -} - -/* form settings: success message */ -#mailpoet_on_success textarea, -#mailpoet_on_success select { - width:100%; -} - -#mailpoet_on_success textarea { - height:50px; - min-height: 50px; - resize:vertical; -} - -/* make sure textareas within the form editor are not resizeable */ -.mailpoet_form_block textarea { - resize:none; -} -/* remove click events from inputs within form editor */ -.mailpoet_form_block input, -.mailpoet_form_block textarea { - pointer-events:none; -} - -/* form export */ -#mailpoet_form_export textarea { - width:340px; - height:150px; - min-height: 150px; - resize:vertical; - font-size:85%; - display:none; -} - -/** Styling for WP 3.8 and higher */ -.mailpoet_form_field_edit, -.mailpoet_form_field_delete { - text-decoration: none; -} -.mailpoet_form_field_edit:hover .dashicons-admin-generic:before, -.mailpoet_form_field_delete:hover .dashicons-dismiss:before, -.settings:hover .dashicons-admin-generic:before { - color: #2ea2cc; -} -.mailpoet_form_field_edit span, -.mailpoet_form_field_delete span { - background: none !important; - color: #999; -} -.mailpoet_form_field_delete span:before { - font-size: 21px; -} - - -/* Code Mirror */ -.CodeMirror { - border: 1px solid #eee; -} \ No newline at end of file diff --git a/assets/css/rtl.css b/assets/css/rtl.css deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/assets/js/admin.js b/assets/js/admin.js deleted file mode 100644 index 688b76cba3..0000000000 --- a/assets/js/admin.js +++ /dev/null @@ -1,13 +0,0 @@ -define('admin', [ - 'mailpoet', - 'jquery', - 'handlebars', - ], function(MailPoet, jQuery, Handlebars) { - console.log('OVER HERE', MailPoet, jQuery, Handlebars); - jQuery(function($) { - // dom ready - $(function() { - - }); - }); -}); diff --git a/assets/js/mailpoet.js b/assets/js/mailpoet.js deleted file mode 100644 index 5b88379272..0000000000 --- a/assets/js/mailpoet.js +++ /dev/null @@ -1,9 +0,0 @@ -define('mailpoet', [], function() { - // A placeholder for MailPoet object - var MailPoet = {}; - - // Expose MailPoet globally - window.MailPoet = MailPoet; - - return MailPoet; -}); diff --git a/assets/js/src/admin.js b/assets/js/src/admin.js index b9c893b086..5aaadb5822 100644 --- a/assets/js/src/admin.js +++ b/assets/js/src/admin.js @@ -1,21 +1,12 @@ -webpackJsonp([0],[ -/* 0 */ -/***/ function(module, exports, __webpack_require__) { +define('admin', [ + 'mailpoet', + 'jquery', + 'handlebars', + ], function(MailPoet, jQuery, Handlebars) { + jQuery(function($) { + // dom ready + $(function() { - var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;!(__WEBPACK_AMD_DEFINE_ARRAY__ = [ - __webpack_require__(1), - __webpack_require__(2), - __webpack_require__(3), - ], __WEBPACK_AMD_DEFINE_RESULT__ = function(MailPoet, jQuery, Handlebars) { - console.log('OVER HERE', MailPoet, jQuery, Handlebars); - jQuery(function($) { - // dom ready - $(function() { - - }); - }); - }.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); - - -/***/ } -]); \ No newline at end of file + }); + }); +}); diff --git a/assets/js/ajax.js b/assets/js/src/ajax.js similarity index 100% rename from assets/js/ajax.js rename to assets/js/src/ajax.js diff --git a/assets/js/form_editor.js b/assets/js/src/form_editor.js similarity index 100% rename from assets/js/form_editor.js rename to assets/js/src/form_editor.js diff --git a/assets/js/handlebars_helpers.js b/assets/js/src/handlebars_helpers.js similarity index 100% rename from assets/js/handlebars_helpers.js rename to assets/js/src/handlebars_helpers.js diff --git a/assets/js/src/mailpoet.js b/assets/js/src/mailpoet.js index fe25d3165a..5b88379272 100644 --- a/assets/js/src/mailpoet.js +++ b/assets/js/src/mailpoet.js @@ -1,921 +1,9 @@ -webpackJsonp([1],[ -/* 0 */ -/***/ function(module, exports, __webpack_require__) { +define('mailpoet', [], function() { + // A placeholder for MailPoet object + var MailPoet = {}; - __webpack_require__(1); - __webpack_require__(11); - __webpack_require__(12); - module.exports = __webpack_require__(13); + // Expose MailPoet globally + window.MailPoet = MailPoet; - -/***/ }, -/* 1 */, -/* 2 */, -/* 3 */, -/* 4 */, -/* 5 */, -/* 6 */, -/* 7 */, -/* 8 */, -/* 9 */, -/* 10 */, -/* 11 */ -/***/ function(module, exports, __webpack_require__) { - - var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(1), __webpack_require__(2)], __WEBPACK_AMD_DEFINE_RESULT__ = function(MailPoet, jQuery) { - "use strict"; - /** - * MailPoet Ajax - **/ - - MailPoet.Ajax = { - version: 0.1, - options: {}, - defaults: { - url: null, - controller: 'dummy', - action: 'test', - data: {}, - onSuccess: function(data, textStatus, xhr) {}, - onError: function(xhr, textStatus, errorThrown) {} - }, - get: function(options) { - this.request('get', options); - }, - post: function(options) { - this.request('post', options); - }, - delete: function(options) { - this.request('delete', options); - }, - init: function(options) { - // merge options - this.options = jQuery.extend({}, this.defaults, options); - - if(this.options.url === null) { - this.options.url = ajaxurl+'?action=mailpoet_ajax'; - } - - // routing - this.options.url += '&mailpoet_controller='+this.options.controller; - this.options.url += '&mailpoet_action='+this.options.action; - }, - request: function(method, options) { - // set options - this.init(options); - - // make ajax request depending on method - if(method === 'get') { - jQuery.get( - this.options.url, - this.options.data, - this.options.onSuccess, - 'json' - ); - } else { - jQuery.ajax( - this.options.url, - { - data: JSON.stringify(this.options.data), - processData: false, - contentType: "application/json; charset=utf-8", - type : method, - dataType: 'json', - success : this.options.onSuccess, - error : this.options.onError - } - ); - } - } - }; - }.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); - - -/***/ }, -/* 12 */ -/***/ function(module, exports, __webpack_require__) { - - var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(1), __webpack_require__(2)], __WEBPACK_AMD_DEFINE_RESULT__ = function(MailPoet, jQuery) { - "use strict"; - /*================================================================================================== - - MailPoet Modal: - - version: 0.8 - author: Jonathan Labreuille - company: Wysija - dependencies: jQuery - - - Options: - - Mandatory: - // Modal window's title - (string) title: 'Modal title' - - // template - (string) template: jQuery('#handlebars_template').html() or - literal html - - Optional: - // jQuery cached element object node to be displayed, - // instead of creating a new one - (object) element: jQuery(selector) - - // - data object that will be passed to the template when rendering - (object) data: {}, - - // - data will be loaded via this url and passed to the template - // when rendering - // - if a "data" option was specified, it will be merged with the - // ajax's response data - (string) url: '/url.json' - - // ajax method - (string) method: 'post' (default: 'get') - - // ajax post params - (object) params: {} - - // - integers are expressed in pixels - (mixed) width: '50%' | 100 | '100px' - - // - integers are expressed in pixels - // - will be ignored when in "panel" mode - (mixed) height: '50%' | 100 | '100px' - - // - only used for "panel" mode - // - will be ignored in "popup" mode - (string) position: 'left' | 'right' - - // display overlay or not - (boolean) overlay: true | false - - // element(s) to be highlighted when the overlay is "on" - (object) highlight: jQuery element - - // callbacks - (function) onInit: called when the modal is displayed - (function) onSuccess: called by calling MailPoet_Guide.success() - (function) onCancel: called when closing the popup - or by calling MailPoet_Guide.cancel() - - Usage: - - // popup mode - MailPoet.Modal.popup(options); - - // panel mode - MailPoet.Modal.panel(options); - - // loading states - MailPoet.Modal.loading(true); // displays loading indicator - MailPoet.Modal.loading(false); // hides loading indicator - - ==================================================================================================*/ - - MailPoet.Modal = { - version: 0.8, - - // flags - initialized: false, - opened: false, - locked: false, - - // sub panels - subpanels: [], - - // default values - defaults: { - // title - title: null, - - // type - type: null, - - // positionning - position: 'right', - - // data sources - data: {}, - url: null, - method: 'get', - params: {}, - - // template - template: null, - body_template: null, - - // dimensions - width: 'auto', - height: 'auto', - - // display overlay - overlay: false, - - // highlighted elements - highlight: null, - - // callbacks - onInit: null, - onSuccess: null, - onCancel: null - }, - renderer: 'html', - options: {}, - templates: { - overlay: '', - popup: '
'+ - '
'+ - ''+ - '

'+ - '
'+ - '
'+ - '
', - loading: '', - panel: '
'+ - ''+ - '
'+ - '
'+ - '
'+ - '
', - subpanel: '
'+ - '
'+ - '
' - }, - setRenderer: function() { - this.renderer = (typeof(Handlebars) === "undefined") ? 'html' : 'handlebars'; - }, - compileTemplate: function(template) { - if(this.renderer === 'html') { - return function() { return template; }; - } else { - return Handlebars.compile(template); - } - }, - init: function(options) { - if(this.initialized === true) { - this.close(); - } - - // merge options - this.options = jQuery.extend({}, this.defaults, options); - - // set renderer - this.setRenderer(); - - // init overlay - this.initOverlay(); - - // toggle overlay - this.toggleOverlay(this.options.overlay); - - if(this.options.type !== null) { - // insert modal depending on its type - if(this.options.type === 'popup') { - var modal = this.compileTemplate(this.templates[this.options.type]); - // create modal - jQuery('#mailpoet_modal_overlay').append(modal(this.options)); - // set title - jQuery('#mailpoet_popup_title h2').html(this.options.title); - } else if(this.options.type === 'panel') { - // create panel - jQuery('#mailpoet_modal_overlay').after(this.templates[this.options.type]); - } - - // add proper overlay class - jQuery('#mailpoet_modal_overlay') - .removeClass('mailpoet_popup_overlay mailpoet_panel_overlay') - .addClass('mailpoet_'+this.options.type+'_overlay'); - } - - // render template if specified - if(this.options.template !== null) { - // set "success" callback if specified - if(options.onSuccess !== undefined) { - this.options.onSuccess = options.onSuccess; - } - - // set "cancel" callback if specified - if(options.onCancel !== undefined) { - this.options.onCancel = options.onCancel; - } - - // compile template - this.options.body_template = this.compileTemplate(this.options.template); - - // setup events - this.setupEvents(); - } - - // set popup as initialized - this.initialized = true; - - return this; - }, - initOverlay: function(toggle) { - if(jQuery('#mailpoet_modal_overlay').length === 0) { - // insert overlay into the DOM - jQuery('body').append(this.templates.overlay); - // insert loading indicator into overlay - jQuery('#mailpoet_modal_overlay').append(this.templates.loading); - } - return this; - }, - toggleOverlay: function(toggle) { - if(toggle === true) { - jQuery('#mailpoet_modal_overlay').removeClass('mailpoet_overlay_hidden'); - } else { - jQuery('#mailpoet_modal_overlay').addClass('mailpoet_overlay_hidden'); - } - - return this; - }, - setupEvents: function() { - // close popup when user clicks on close button - jQuery('#mailpoet_modal_close').on('click', this.cancel.bind(this)); - - // close popup when user clicks on overlay - jQuery('#mailpoet_modal_overlay').on('click', function(e) { - // we need to make sure that we are actually clicking on the overlay - // because when clicking on the popup content, it will trigger the click - // event on the overlay - if(e.target.id === 'mailpoet_modal_overlay') { this.cancel(); } - }.bind(this)); - - // close popup when user presses ESC key - jQuery(document).on('keyup.mailpoet_modal', function(e) { - if(this.opened === false) { return false; } - if(e.keyCode === 27) { this.cancel(); } - }.bind(this)); - - // make sure the popup is repositioned when the window is resized - jQuery(window).on('resize.mailpoet_modal', function() { - this.setPosition(); - }.bind(this)); - - return this; - }, - removeEvents: function() { - jQuery(document).unbind('keyup.mailpoet_modal'); - jQuery(window).unbind('resize.mailpoet_modal'); - jQuery('#mailpoet_modal_close').off('click'); - if(this.options.overlay === true) { - jQuery('#mailpoet_modal_overlay').off('click'); - } - - return this; - }, - lock: function() { - this.locked = true; - - return this; - }, - unlock: function() { - this.locked = false; - - return this; - }, - isLocked: function() { - return this.locked; - }, - loadTemplate: function() { - if(this.subpanels.length > 0) { - // hide panel - jQuery('.mailpoet_'+this.options.type+'_wrapper').hide(); - - // add sub panel wrapper - jQuery('#mailpoet_'+this.options.type).append(this.templates['subpanel']); - - // add sub panel content - jQuery('.mailpoet_'+this.options.type+'_body').last().html(this.subpanels[(this.subpanels.length - 1)].element); - } else if (this.options.element) { - jQuery('.mailpoet_'+this.options.type+'_body').empty(); - jQuery('.mailpoet_'+this.options.type+'_body').append(this.options.element); - } else { - jQuery('.mailpoet_'+this.options.type+'_body').html( - this.options.body_template( - this.options.data - ) - ); - } - - return this; - }, - loadUrl: function() { - if(this.options.method === 'get') { - // make ajax request - jQuery.getJSON(this.options.url, function(data) { - // merge returned data with existing data passed when calling the "open" method - this.options.data = jQuery.extend({}, this.options.data, data); - // load template using fetched data - this.loadTemplate(); - // show modal window - this.showModal(); - }.bind(this)); - } else if(this.options.method === 'post') { - // make ajax request - jQuery.post(this.options.url, JSON.stringify(this.options.params), function(data) { - // merge returned data with existing data passed when calling the "open" method - this.options.data = jQuery.extend({}, this.options.data, data); - // load template using fetched data - this.loadTemplate(); - // show modal window - this.showModal(); - }.bind(this), 'json'); - } - - return this; - }, - setDimensions: function() { - switch(this.options.type) { - case 'popup': - // set popup dimensions - jQuery('#mailpoet_popup').css({ - width: this.options.width, - minHeight: this.options.height - }); - // set popup wrapper height - jQuery('#mailpoet_popup_wrapper').css({ height: this.options.height}); - break; - case 'panel': - // set dimensions - if(this.options.position === 'right') { - jQuery('#mailpoet_panel').css({ - width: this.options.width, - right: 0, - marginRight: '-' + this.options.width, - left: 'auto' - }); - } else if(this.options.position === 'left') { - jQuery('#mailpoet_panel').css({ - width: this.options.width, - left: 0, - marginLeft: '-' + this.options.width, - right: 'auto' - }); - } - jQuery('#mailpoet_panel').css({ minHeight: 'auto' }); - break; - } - - return this; - }, - setPosition: function() { - switch(this.options.type) { - case 'popup': - var screenWidth = jQuery(window).width(), - screenHeight = jQuery(window).height(), - modalWidth = jQuery('.mailpoet_'+ this.options.type +'_wrapper').width(), - modalHeight = jQuery('.mailpoet_'+ this.options.type +'_wrapper').height(); - - var top = Math.max(48, parseInt((screenHeight / 2) - (modalHeight / 2))), - left = Math.max(0, parseInt((screenWidth / 2) - (modalWidth / 2))); - - // set position of popup depending on screen dimensions. - jQuery('#mailpoet_popup').css({ - top: top, - left: left - }); - break; - case 'panel': - setTimeout(function() { - // set position of popup depending on screen dimensions. - if(this.options.position === 'right') { - jQuery('#mailpoet_panel').css( - { marginRight: 0 } - ); - } else if(this.options.position === 'left') { - jQuery('#mailpoet_panel').css( - { marginLeft: 0 } - ); - } - }.bind(this), 0); - break; - } - - return this; - }, - showModal: function() { - // set modal dimensions - this.setDimensions(); - - // add a flag on the body so that we can prevent scrolling (setting overflow hidden) - jQuery('body').addClass('mailpoet_modal_opened'); - - // show popup - jQuery('#mailpoet_'+this.options.type).show(); - - // display overlay - this.showOverlay(); - - // set modal position - this.setPosition(); - - // add class on highlighted elements - if(this.options.highlight !== null) { - if(this.options.highlight.length > 0) { - this.highlightOn(this.options.highlight); - } - } - - // set popup as opened - this.opened = true; - - // trigger init event if specified - if(this.options.onInit !== null) { - this.options.onInit(); - } - - return this; - }, - highlightOn: function(element) { - jQuery(element).addClass('mailpoet_modal_highlight'); - return this; - }, - highlightOff: function() { - jQuery('.mailpoet_modal_highlight').removeClass('mailpoet_modal_highlight'); - return this; - }, - hideModal: function(callback) { - // set modal as closed - this.opened = false; - - // hide modal - jQuery('#mailpoet_'+this.options.type).hide(); - - // remove class on highlighted elements - this.highlightOff(); - - // remove class from body to let it be scrollable - jQuery('body').removeClass('mailpoet_modal_opened'); - - return this; - }, - showOverlay: function(force) { - jQuery('#mailpoet_modal_overlay').show(); - return this; - }, - hideOverlay: function() { - jQuery('#mailpoet_modal_overlay').hide(); - return this; - }, - popup: function(options) { - // get options - options = options || {}; - // set modal type - options.type = 'popup'; - // set overlay state - options.overlay = options.overlay || true; - // initialize modal - this.init(options); - // open modal - this.open(); - - return this; - }, - panel: function(options) { - // get options - options = options || {}; - // reset subpanels - this.subpanels = []; - // set modal type - options.type = 'panel'; - // set overlay state - options.overlay = options.overlay || false; - // set highlighted element - options.highlight = options.highlight || null; - // set modal dimensions - options.width = options.width || '40%'; - options.height = options.height || 'auto'; - // initialize modal - this.init(options); - // open modal - this.open(); - - return this; - }, - subpanel: function(options) { - if(this.opened === false) { - // if no panel is already opened, let's create one instead - this.panel(options); - } else { - // if a panel is already opened, add a sub panel to it - this.subpanels.push(options); - this.loadTemplate(); - } - - return this; - }, - loading: function(toggle) { - // make sure the overlay is initialized and that it's visible - this.initOverlay(true); - - if(toggle === true) { - this.showLoading(); - } else { - this.hideLoading(); - } - - return this; - }, - showLoading: function() { - jQuery('#mailpoet_loading').show(); - - // add loading class to overlay - jQuery('#mailpoet_modal_overlay').addClass('mailpoet_overlay_loading'); - - return this; - }, - hideLoading: function() { - jQuery('#mailpoet_loading').hide(); - - // remove loading class from overlay - jQuery('#mailpoet_modal_overlay').removeClass('mailpoet_overlay_loading'); - - return this; - }, - open: function() { - // load template if specified - if(this.options.template !== null) { - // check if a url was specified to get extra data - if(this.options.url !== null) { - this.loadUrl(); - } else { - // load template - this.loadTemplate(); - - // show modal window - this.showModal(); - } - } else { - this.cancel(); - } - - return this; - }, - success: function() { - if(this.subpanels.length > 0) { - if(this.subpanels[(this.subpanels.length - 1)].onSuccess !== undefined) { - this.subpanels[(this.subpanels.length - 1)].onSuccess(this.subpanels[(this.subpanels.length - 1)].data); - } - } else { - if(this.options.onSuccess !== null) { - this.options.onSuccess(this.options.data); - } - } - this.close(); - - return this; - }, - cancel: function() { - if(this.subpanels.length > 0) { - if(this.subpanels[(this.subpanels.length - 1)].onCancel !== undefined) { - this.subpanels[(this.subpanels.length - 1)].onCancel(this.subpanels[(this.subpanels.length - 1)].data); - } - } else { - if(this.options.onCancel !== null) { - this.options.onCancel(this.options.data); - } - } - this.close(); - - return this; - }, - destroy: function() { - this.hideOverlay(); - - // remove extra modal - if(jQuery('#mailpoet_'+this.options.type).length > 0) { - jQuery('#mailpoet_'+this.options.type).remove(); - } - - this.initialized = false; - - return this; - }, - close: function() { - if(this.isLocked() === true) return this; - - if(this.subpanels.length > 0) { - - // close subpanel - jQuery('.mailpoet_'+this.options.type+'_wrapper').last().remove(); - - // show previous panel - jQuery('.mailpoet_'+this.options.type+'_wrapper').last().show(); - - // remove last subpanels - this.subpanels.pop(); - - return this; - } - - // remove event handlers - this.removeEvents(); - - // hide modal window - this.hideModal(); - - // destroy modal element - this.destroy(); - - // reset options - this.options = { - onSuccess: null, - onCancel: null - }; - - return this; - } - }; - }.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); - - -/***/ }, -/* 13 */ -/***/ function(module, exports, __webpack_require__) { - - var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(1), __webpack_require__(2)], __WEBPACK_AMD_DEFINE_RESULT__ = function(MailPoet, jQuery) { - "use strict"; - /*================================================================================================== - - MailPoet Notice: - - description: Handles notices - version: 0.2 - author: Jonathan Labreuille - company: Wysija - dependencies: jQuery - - Usage: - - // success message (static: false) - MailPoet.Notice.success('Yatta!'); - - // error message (static: false) - MailPoet.Notice.error('Boo!'); - - // system message (static: true) - MailPoet.Notice.system('You need to updated ASAP!'); - - Examples: - - MailPoet.Notice.success('- success #1 -'); - setTimeout(function() { - MailPoet.Notice.success('- success #2 -'); - setTimeout(function() { - MailPoet.Notice.error('- error -'); - setTimeout(function() { - MailPoet.Notice.system('- system -'); - - setTimeout(function() { - MailPoet.Notice.hide(); - }, 2500); - }, 300); - }, 400); - }, 500); - - ==================================================================================================*/ - - MailPoet.Notice = { - version: 0.2, - // default options - defaults: { - type: 'success', - message: '', - static: false, - scroll: false, - timeout: 2000, - onOpen: null, - onClose: null - }, - options: {}, - init: function(options) { - // set options - this.options = jQuery.extend({}, this.defaults, options); - - // clone element - this.element = jQuery('#mailpoet_notice_'+this.options.type).clone(); - - // remove id from clone - this.element.removeAttr('id'); - - // insert notice after its parent - jQuery('#mailpoet_notice_'+this.options.type).after(this.element); - - // setup onClose callback - var onClose = null; - if(this.options.onClose !== null) { - onClose = this.options.onClose; - } - - // listen to remove event - var element = this.element; - jQuery(this.element).on('close', function() { - jQuery(this).fadeOut(200, function() { - // on close callback - if(onClose !== null) { - onClose(); - } - // remove notice - jQuery(this).remove(); - }); - }.bind(this.element)); - - // listen to message event - jQuery(this.element).on('message', function(e, message) { - MailPoet.Notice.setMessage(message); - }.bind(this.element)); - - return this; - }, - isHTML: function(str) { - var a = document.createElement('div'); - a.innerHTML = str; - for(var c = a.childNodes, i = c.length; i--;) { - if(c[i].nodeType == 1) return true; - } - return false; - }, - setMessage: function(message) { - // if it's not an html message, let's sugar coat the message with a fancy

- if(this.isHTML(message) === false) { - message = '

'+message+'

'; - } - // set message - return this.element.html(message); - }, - show: function(options) { - // initialize - this.init(options); - - // show notice - this.showNotice(); - - // return this; - }, - showNotice: function() { - // set message - this.setMessage(this.options.message); - - // make the notice appear - this.element.fadeIn(200); - - // if scroll option is enabled, scroll to the notice - if(this.options.scroll === true) { - this.element.get(0).scrollIntoView(false); - } - - // if the notice is not static, it has to disappear after a timeout - if(this.options.static === false) { - this.element.delay(this.options.timeout).trigger('close'); - } else { - this.element.append(''); - this.element.find('.mailpoet_notice_close').on('click', function() { - jQuery(this).trigger('close'); - }); - } - - // call onOpen callback - if(this.options.onOpen !== null) { - this.options.onOpen(this.element); - } - }, - hide: function(all) { - if(all !== undefined && all === true) { - jQuery('.mailpoet_notice:not([id])').trigger('close'); - } else { - jQuery('.mailpoet_notice.updated:not([id]), .mailpoet_notice.error:not([id])') - .trigger('close'); - } - }, - error: function(message, options) { - this.show(jQuery.extend({}, { - type: 'error', - message: '

'+message+'

' - }, options)); - }, - success: function(message, options) { - this.show(jQuery.extend({}, { - type: 'success', - message: '

'+message+'

' - }, options)); - }, - system: function(message, options) { - this.show(jQuery.extend({}, { - type: 'system', - static: true, - message: message - }, options)); - } - }; - }.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); - - -/***/ } -]); \ No newline at end of file + return MailPoet; +}); diff --git a/assets/js/modal.js b/assets/js/src/modal.js similarity index 100% rename from assets/js/modal.js rename to assets/js/src/modal.js diff --git a/assets/js/notice.js b/assets/js/src/notice.js similarity index 100% rename from assets/js/notice.js rename to assets/js/src/notice.js diff --git a/assets/js/public.js b/assets/js/src/public.js similarity index 100% rename from assets/js/public.js rename to assets/js/src/public.js diff --git a/assets/js/src/vendor.js b/assets/js/src/vendor.js deleted file mode 100644 index 6aba369dce..0000000000 --- a/assets/js/src/vendor.js +++ /dev/null @@ -1,1072 +0,0 @@ -/******/ (function(modules) { // webpackBootstrap -/******/ // install a JSONP callback for chunk loading -/******/ var parentJsonpFunction = window["webpackJsonp"]; -/******/ window["webpackJsonp"] = function webpackJsonpCallback(chunkIds, moreModules) { -/******/ // add "moreModules" to the modules object, -/******/ // then flag all "chunkIds" as loaded and fire callback -/******/ var moduleId, chunkId, i = 0, callbacks = []; -/******/ for(;i < chunkIds.length; i++) { -/******/ chunkId = chunkIds[i]; -/******/ if(installedChunks[chunkId]) -/******/ callbacks.push.apply(callbacks, installedChunks[chunkId]); -/******/ installedChunks[chunkId] = 0; -/******/ } -/******/ for(moduleId in moreModules) { -/******/ modules[moduleId] = moreModules[moduleId]; -/******/ } -/******/ if(parentJsonpFunction) parentJsonpFunction(chunkIds, moreModules); -/******/ while(callbacks.length) -/******/ callbacks.shift().call(null, __webpack_require__); -/******/ if(moreModules[0]) { -/******/ installedModules[0] = 0; -/******/ return __webpack_require__(0); -/******/ } -/******/ }; - -/******/ // The module cache -/******/ var installedModules = {}; - -/******/ // object to store loaded and loading chunks -/******/ // "0" means "already loaded" -/******/ // Array means "loading", array contains callbacks -/******/ var installedChunks = { -/******/ 2:0 -/******/ }; - -/******/ // The require function -/******/ function __webpack_require__(moduleId) { - -/******/ // Check if module is in cache -/******/ if(installedModules[moduleId]) -/******/ return installedModules[moduleId].exports; - -/******/ // Create a new module (and put it into the cache) -/******/ var module = installedModules[moduleId] = { -/******/ exports: {}, -/******/ id: moduleId, -/******/ loaded: false -/******/ }; - -/******/ // Execute the module function -/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); - -/******/ // Flag the module as loaded -/******/ module.loaded = true; - -/******/ // Return the exports of the module -/******/ return module.exports; -/******/ } - -/******/ // This file contains only the entry chunk. -/******/ // The chunk loading function for additional chunks -/******/ __webpack_require__.e = function requireEnsure(chunkId, callback) { -/******/ // "0" is the signal for "already loaded" -/******/ if(installedChunks[chunkId] === 0) -/******/ return callback.call(null, __webpack_require__); - -/******/ // an array means "currently loading". -/******/ if(installedChunks[chunkId] !== undefined) { -/******/ installedChunks[chunkId].push(callback); -/******/ } else { -/******/ // start chunk loading -/******/ installedChunks[chunkId] = [callback]; -/******/ var head = document.getElementsByTagName('head')[0]; -/******/ var script = document.createElement('script'); -/******/ script.type = 'text/javascript'; -/******/ script.charset = 'utf-8'; -/******/ script.async = true; - -/******/ script.src = __webpack_require__.p + "" + chunkId + "." + ({"0":"admin","1":"mailpoet"}[chunkId]||chunkId) + ".js"; -/******/ head.appendChild(script); -/******/ } -/******/ }; - -/******/ // expose the modules object (__webpack_modules__) -/******/ __webpack_require__.m = modules; - -/******/ // expose the module cache -/******/ __webpack_require__.c = installedModules; - -/******/ // __webpack_public_path__ -/******/ __webpack_require__.p = ""; - -/******/ // Load entry module and return exports -/******/ return __webpack_require__(0); -/******/ }) -/************************************************************************/ -/******/ ([ -/* 0 */ -/***/ function(module, exports, __webpack_require__) { - - __webpack_require__(3); - module.exports = __webpack_require__(14); - - -/***/ }, -/* 1 */ -/***/ function(module, exports, __webpack_require__) { - - var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;!(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = function() { - // A placeholder for MailPoet object - var MailPoet = {}; - - // Expose MailPoet globally - window.MailPoet = MailPoet; - - return MailPoet; - }.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); - - -/***/ }, -/* 2 */ -/***/ function(module, exports) { - - module.exports = jQuery; - -/***/ }, -/* 3 */ -/***/ function(module, exports, __webpack_require__) { - - // Create a simple path alias to allow browserify to resolve - // the runtime on a supported path. - module.exports = __webpack_require__(4)['default']; - - -/***/ }, -/* 4 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var _interopRequireWildcard = function (obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }; - - exports.__esModule = true; - - var _import = __webpack_require__(5); - - var base = _interopRequireWildcard(_import); - - // Each of these augment the Handlebars object. No need to setup here. - // (This is done to easily share code between commonjs and browse envs) - - var _SafeString = __webpack_require__(8); - - var _SafeString2 = _interopRequireWildcard(_SafeString); - - var _Exception = __webpack_require__(7); - - var _Exception2 = _interopRequireWildcard(_Exception); - - var _import2 = __webpack_require__(6); - - var Utils = _interopRequireWildcard(_import2); - - var _import3 = __webpack_require__(9); - - var runtime = _interopRequireWildcard(_import3); - - var _noConflict = __webpack_require__(10); - - var _noConflict2 = _interopRequireWildcard(_noConflict); - - // For compatibility and usage outside of module systems, make the Handlebars object a namespace - function create() { - var hb = new base.HandlebarsEnvironment(); - - Utils.extend(hb, base); - hb.SafeString = _SafeString2['default']; - hb.Exception = _Exception2['default']; - hb.Utils = Utils; - hb.escapeExpression = Utils.escapeExpression; - - hb.VM = runtime; - hb.template = function (spec) { - return runtime.template(spec, hb); - }; - - return hb; - } - - var inst = create(); - inst.create = create; - - _noConflict2['default'](inst); - - inst['default'] = inst; - - exports['default'] = inst; - module.exports = exports['default']; - -/***/ }, -/* 5 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var _interopRequireWildcard = function (obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }; - - exports.__esModule = true; - exports.HandlebarsEnvironment = HandlebarsEnvironment; - exports.createFrame = createFrame; - - var _import = __webpack_require__(6); - - var Utils = _interopRequireWildcard(_import); - - var _Exception = __webpack_require__(7); - - var _Exception2 = _interopRequireWildcard(_Exception); - - var VERSION = '3.0.1'; - exports.VERSION = VERSION; - var COMPILER_REVISION = 6; - - exports.COMPILER_REVISION = COMPILER_REVISION; - var REVISION_CHANGES = { - 1: '<= 1.0.rc.2', // 1.0.rc.2 is actually rev2 but doesn't report it - 2: '== 1.0.0-rc.3', - 3: '== 1.0.0-rc.4', - 4: '== 1.x.x', - 5: '== 2.0.0-alpha.x', - 6: '>= 2.0.0-beta.1' - }; - - exports.REVISION_CHANGES = REVISION_CHANGES; - var isArray = Utils.isArray, - isFunction = Utils.isFunction, - toString = Utils.toString, - objectType = '[object Object]'; - - function HandlebarsEnvironment(helpers, partials) { - this.helpers = helpers || {}; - this.partials = partials || {}; - - registerDefaultHelpers(this); - } - - HandlebarsEnvironment.prototype = { - constructor: HandlebarsEnvironment, - - logger: logger, - log: log, - - registerHelper: function registerHelper(name, fn) { - if (toString.call(name) === objectType) { - if (fn) { - throw new _Exception2['default']('Arg not supported with multiple helpers'); - } - Utils.extend(this.helpers, name); - } else { - this.helpers[name] = fn; - } - }, - unregisterHelper: function unregisterHelper(name) { - delete this.helpers[name]; - }, - - registerPartial: function registerPartial(name, partial) { - if (toString.call(name) === objectType) { - Utils.extend(this.partials, name); - } else { - if (typeof partial === 'undefined') { - throw new _Exception2['default']('Attempting to register a partial as undefined'); - } - this.partials[name] = partial; - } - }, - unregisterPartial: function unregisterPartial(name) { - delete this.partials[name]; - } - }; - - function registerDefaultHelpers(instance) { - instance.registerHelper('helperMissing', function () { - if (arguments.length === 1) { - // A missing field in a {{foo}} constuct. - return undefined; - } else { - // Someone is actually trying to call something, blow up. - throw new _Exception2['default']('Missing helper: "' + arguments[arguments.length - 1].name + '"'); - } - }); - - instance.registerHelper('blockHelperMissing', function (context, options) { - var inverse = options.inverse, - fn = options.fn; - - if (context === true) { - return fn(this); - } else if (context === false || context == null) { - return inverse(this); - } else if (isArray(context)) { - if (context.length > 0) { - if (options.ids) { - options.ids = [options.name]; - } - - return instance.helpers.each(context, options); - } else { - return inverse(this); - } - } else { - if (options.data && options.ids) { - var data = createFrame(options.data); - data.contextPath = Utils.appendContextPath(options.data.contextPath, options.name); - options = { data: data }; - } - - return fn(context, options); - } - }); - - instance.registerHelper('each', function (context, options) { - if (!options) { - throw new _Exception2['default']('Must pass iterator to #each'); - } - - var fn = options.fn, - inverse = options.inverse, - i = 0, - ret = '', - data = undefined, - contextPath = undefined; - - if (options.data && options.ids) { - contextPath = Utils.appendContextPath(options.data.contextPath, options.ids[0]) + '.'; - } - - if (isFunction(context)) { - context = context.call(this); - } - - if (options.data) { - data = createFrame(options.data); - } - - function execIteration(field, index, last) { - if (data) { - data.key = field; - data.index = index; - data.first = index === 0; - data.last = !!last; - - if (contextPath) { - data.contextPath = contextPath + field; - } - } - - ret = ret + fn(context[field], { - data: data, - blockParams: Utils.blockParams([context[field], field], [contextPath + field, null]) - }); - } - - if (context && typeof context === 'object') { - if (isArray(context)) { - for (var j = context.length; i < j; i++) { - execIteration(i, i, i === context.length - 1); - } - } else { - var priorKey = undefined; - - for (var key in context) { - if (context.hasOwnProperty(key)) { - // We're running the iterations one step out of sync so we can detect - // the last iteration without have to scan the object twice and create - // an itermediate keys array. - if (priorKey) { - execIteration(priorKey, i - 1); - } - priorKey = key; - i++; - } - } - if (priorKey) { - execIteration(priorKey, i - 1, true); - } - } - } - - if (i === 0) { - ret = inverse(this); - } - - return ret; - }); - - instance.registerHelper('if', function (conditional, options) { - if (isFunction(conditional)) { - conditional = conditional.call(this); - } - - // Default behavior is to render the positive path if the value is truthy and not empty. - // The `includeZero` option may be set to treat the condtional as purely not empty based on the - // behavior of isEmpty. Effectively this determines if 0 is handled by the positive path or negative. - if (!options.hash.includeZero && !conditional || Utils.isEmpty(conditional)) { - return options.inverse(this); - } else { - return options.fn(this); - } - }); - - instance.registerHelper('unless', function (conditional, options) { - return instance.helpers['if'].call(this, conditional, { fn: options.inverse, inverse: options.fn, hash: options.hash }); - }); - - instance.registerHelper('with', function (context, options) { - if (isFunction(context)) { - context = context.call(this); - } - - var fn = options.fn; - - if (!Utils.isEmpty(context)) { - if (options.data && options.ids) { - var data = createFrame(options.data); - data.contextPath = Utils.appendContextPath(options.data.contextPath, options.ids[0]); - options = { data: data }; - } - - return fn(context, options); - } else { - return options.inverse(this); - } - }); - - instance.registerHelper('log', function (message, options) { - var level = options.data && options.data.level != null ? parseInt(options.data.level, 10) : 1; - instance.log(level, message); - }); - - instance.registerHelper('lookup', function (obj, field) { - return obj && obj[field]; - }); - } - - var logger = { - methodMap: { 0: 'debug', 1: 'info', 2: 'warn', 3: 'error' }, - - // State enum - DEBUG: 0, - INFO: 1, - WARN: 2, - ERROR: 3, - level: 1, - - // Can be overridden in the host environment - log: function log(level, message) { - if (typeof console !== 'undefined' && logger.level <= level) { - var method = logger.methodMap[level]; - (console[method] || console.log).call(console, message); // eslint-disable-line no-console - } - } - }; - - exports.logger = logger; - var log = logger.log; - - exports.log = log; - - function createFrame(object) { - var frame = Utils.extend({}, object); - frame._parent = object; - return frame; - } - - /* [args, ]options */ - -/***/ }, -/* 6 */ -/***/ function(module, exports) { - - 'use strict'; - - exports.__esModule = true; - exports.extend = extend; - - // Older IE versions do not directly support indexOf so we must implement our own, sadly. - exports.indexOf = indexOf; - exports.escapeExpression = escapeExpression; - exports.isEmpty = isEmpty; - exports.blockParams = blockParams; - exports.appendContextPath = appendContextPath; - var escape = { - '&': '&', - '<': '<', - '>': '>', - '"': '"', - '\'': ''', - '`': '`' - }; - - var badChars = /[&<>"'`]/g, - possible = /[&<>"'`]/; - - function escapeChar(chr) { - return escape[chr]; - } - - function extend(obj /* , ...source */) { - for (var i = 1; i < arguments.length; i++) { - for (var key in arguments[i]) { - if (Object.prototype.hasOwnProperty.call(arguments[i], key)) { - obj[key] = arguments[i][key]; - } - } - } - - return obj; - } - - var toString = Object.prototype.toString; - - exports.toString = toString; - // Sourced from lodash - // https://github.com/bestiejs/lodash/blob/master/LICENSE.txt - /*eslint-disable func-style, no-var */ - var isFunction = function isFunction(value) { - return typeof value === 'function'; - }; - // fallback for older versions of Chrome and Safari - /* istanbul ignore next */ - if (isFunction(/x/)) { - exports.isFunction = isFunction = function (value) { - return typeof value === 'function' && toString.call(value) === '[object Function]'; - }; - } - var isFunction; - exports.isFunction = isFunction; - /*eslint-enable func-style, no-var */ - - /* istanbul ignore next */ - var isArray = Array.isArray || function (value) { - return value && typeof value === 'object' ? toString.call(value) === '[object Array]' : false; - };exports.isArray = isArray; - - function indexOf(array, value) { - for (var i = 0, len = array.length; i < len; i++) { - if (array[i] === value) { - return i; - } - } - return -1; - } - - function escapeExpression(string) { - if (typeof string !== 'string') { - // don't escape SafeStrings, since they're already safe - if (string && string.toHTML) { - return string.toHTML(); - } else if (string == null) { - return ''; - } else if (!string) { - return string + ''; - } - - // Force a string conversion as this will be done by the append regardless and - // the regex test will do this transparently behind the scenes, causing issues if - // an object's to string has escaped characters in it. - string = '' + string; - } - - if (!possible.test(string)) { - return string; - } - return string.replace(badChars, escapeChar); - } - - function isEmpty(value) { - if (!value && value !== 0) { - return true; - } else if (isArray(value) && value.length === 0) { - return true; - } else { - return false; - } - } - - function blockParams(params, ids) { - params.path = ids; - return params; - } - - function appendContextPath(contextPath, id) { - return (contextPath ? contextPath + '.' : '') + id; - } - -/***/ }, -/* 7 */ -/***/ function(module, exports) { - - 'use strict'; - - exports.__esModule = true; - - var errorProps = ['description', 'fileName', 'lineNumber', 'message', 'name', 'number', 'stack']; - - function Exception(message, node) { - var loc = node && node.loc, - line = undefined, - column = undefined; - if (loc) { - line = loc.start.line; - column = loc.start.column; - - message += ' - ' + line + ':' + column; - } - - var tmp = Error.prototype.constructor.call(this, message); - - // Unfortunately errors are not enumerable in Chrome (at least), so `for prop in tmp` doesn't work. - for (var idx = 0; idx < errorProps.length; idx++) { - this[errorProps[idx]] = tmp[errorProps[idx]]; - } - - if (Error.captureStackTrace) { - Error.captureStackTrace(this, Exception); - } - - if (loc) { - this.lineNumber = line; - this.column = column; - } - } - - Exception.prototype = new Error(); - - exports['default'] = Exception; - module.exports = exports['default']; - -/***/ }, -/* 8 */ -/***/ function(module, exports) { - - 'use strict'; - - exports.__esModule = true; - // Build out our basic SafeString type - function SafeString(string) { - this.string = string; - } - - SafeString.prototype.toString = SafeString.prototype.toHTML = function () { - return '' + this.string; - }; - - exports['default'] = SafeString; - module.exports = exports['default']; - -/***/ }, -/* 9 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var _interopRequireWildcard = function (obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }; - - exports.__esModule = true; - exports.checkRevision = checkRevision; - - // TODO: Remove this line and break up compilePartial - - exports.template = template; - exports.wrapProgram = wrapProgram; - exports.resolvePartial = resolvePartial; - exports.invokePartial = invokePartial; - exports.noop = noop; - - var _import = __webpack_require__(6); - - var Utils = _interopRequireWildcard(_import); - - var _Exception = __webpack_require__(7); - - var _Exception2 = _interopRequireWildcard(_Exception); - - var _COMPILER_REVISION$REVISION_CHANGES$createFrame = __webpack_require__(5); - - function checkRevision(compilerInfo) { - var compilerRevision = compilerInfo && compilerInfo[0] || 1, - currentRevision = _COMPILER_REVISION$REVISION_CHANGES$createFrame.COMPILER_REVISION; - - if (compilerRevision !== currentRevision) { - if (compilerRevision < currentRevision) { - var runtimeVersions = _COMPILER_REVISION$REVISION_CHANGES$createFrame.REVISION_CHANGES[currentRevision], - compilerVersions = _COMPILER_REVISION$REVISION_CHANGES$createFrame.REVISION_CHANGES[compilerRevision]; - throw new _Exception2['default']('Template was precompiled with an older version of Handlebars than the current runtime. ' + 'Please update your precompiler to a newer version (' + runtimeVersions + ') or downgrade your runtime to an older version (' + compilerVersions + ').'); - } else { - // Use the embedded version info since the runtime doesn't know about this revision yet - throw new _Exception2['default']('Template was precompiled with a newer version of Handlebars than the current runtime. ' + 'Please update your runtime to a newer version (' + compilerInfo[1] + ').'); - } - } - } - - function template(templateSpec, env) { - /* istanbul ignore next */ - if (!env) { - throw new _Exception2['default']('No environment passed to template'); - } - if (!templateSpec || !templateSpec.main) { - throw new _Exception2['default']('Unknown template object: ' + typeof templateSpec); - } - - // Note: Using env.VM references rather than local var references throughout this section to allow - // for external users to override these as psuedo-supported APIs. - env.VM.checkRevision(templateSpec.compiler); - - function invokePartialWrapper(partial, context, options) { - if (options.hash) { - context = Utils.extend({}, context, options.hash); - } - - partial = env.VM.resolvePartial.call(this, partial, context, options); - var result = env.VM.invokePartial.call(this, partial, context, options); - - if (result == null && env.compile) { - options.partials[options.name] = env.compile(partial, templateSpec.compilerOptions, env); - result = options.partials[options.name](context, options); - } - if (result != null) { - if (options.indent) { - var lines = result.split('\n'); - for (var i = 0, l = lines.length; i < l; i++) { - if (!lines[i] && i + 1 === l) { - break; - } - - lines[i] = options.indent + lines[i]; - } - result = lines.join('\n'); - } - return result; - } else { - throw new _Exception2['default']('The partial ' + options.name + ' could not be compiled when running in runtime-only mode'); - } - } - - // Just add water - var container = { - strict: function strict(obj, name) { - if (!(name in obj)) { - throw new _Exception2['default']('"' + name + '" not defined in ' + obj); - } - return obj[name]; - }, - lookup: function lookup(depths, name) { - var len = depths.length; - for (var i = 0; i < len; i++) { - if (depths[i] && depths[i][name] != null) { - return depths[i][name]; - } - } - }, - lambda: function lambda(current, context) { - return typeof current === 'function' ? current.call(context) : current; - }, - - escapeExpression: Utils.escapeExpression, - invokePartial: invokePartialWrapper, - - fn: function fn(i) { - return templateSpec[i]; - }, - - programs: [], - program: function program(i, data, declaredBlockParams, blockParams, depths) { - var programWrapper = this.programs[i], - fn = this.fn(i); - if (data || depths || blockParams || declaredBlockParams) { - programWrapper = wrapProgram(this, i, fn, data, declaredBlockParams, blockParams, depths); - } else if (!programWrapper) { - programWrapper = this.programs[i] = wrapProgram(this, i, fn); - } - return programWrapper; - }, - - data: function data(value, depth) { - while (value && depth--) { - value = value._parent; - } - return value; - }, - merge: function merge(param, common) { - var obj = param || common; - - if (param && common && param !== common) { - obj = Utils.extend({}, common, param); - } - - return obj; - }, - - noop: env.VM.noop, - compilerInfo: templateSpec.compiler - }; - - function ret(context) { - var options = arguments[1] === undefined ? {} : arguments[1]; - - var data = options.data; - - ret._setup(options); - if (!options.partial && templateSpec.useData) { - data = initData(context, data); - } - var depths = undefined, - blockParams = templateSpec.useBlockParams ? [] : undefined; - if (templateSpec.useDepths) { - depths = options.depths ? [context].concat(options.depths) : [context]; - } - - return templateSpec.main.call(container, context, container.helpers, container.partials, data, blockParams, depths); - } - ret.isTop = true; - - ret._setup = function (options) { - if (!options.partial) { - container.helpers = container.merge(options.helpers, env.helpers); - - if (templateSpec.usePartial) { - container.partials = container.merge(options.partials, env.partials); - } - } else { - container.helpers = options.helpers; - container.partials = options.partials; - } - }; - - ret._child = function (i, data, blockParams, depths) { - if (templateSpec.useBlockParams && !blockParams) { - throw new _Exception2['default']('must pass block params'); - } - if (templateSpec.useDepths && !depths) { - throw new _Exception2['default']('must pass parent depths'); - } - - return wrapProgram(container, i, templateSpec[i], data, 0, blockParams, depths); - }; - return ret; - } - - function wrapProgram(container, i, fn, data, declaredBlockParams, blockParams, depths) { - function prog(context) { - var options = arguments[1] === undefined ? {} : arguments[1]; - - return fn.call(container, context, container.helpers, container.partials, options.data || data, blockParams && [options.blockParams].concat(blockParams), depths && [context].concat(depths)); - } - prog.program = i; - prog.depth = depths ? depths.length : 0; - prog.blockParams = declaredBlockParams || 0; - return prog; - } - - function resolvePartial(partial, context, options) { - if (!partial) { - partial = options.partials[options.name]; - } else if (!partial.call && !options.name) { - // This is a dynamic partial that returned a string - options.name = partial; - partial = options.partials[partial]; - } - return partial; - } - - function invokePartial(partial, context, options) { - options.partial = true; - - if (partial === undefined) { - throw new _Exception2['default']('The partial ' + options.name + ' could not be found'); - } else if (partial instanceof Function) { - return partial(context, options); - } - } - - function noop() { - return ''; - } - - function initData(context, data) { - if (!data || !('root' in data)) { - data = data ? _COMPILER_REVISION$REVISION_CHANGES$createFrame.createFrame(data) : {}; - data.root = context; - } - return data; - } - -/***/ }, -/* 10 */ -/***/ function(module, exports) { - - /* WEBPACK VAR INJECTION */(function(global) {'use strict'; - - exports.__esModule = true; - /*global window */ - - exports['default'] = function (Handlebars) { - /* istanbul ignore next */ - var root = typeof global !== 'undefined' ? global : window, - $Handlebars = root.Handlebars; - /* istanbul ignore next */ - Handlebars.noConflict = function () { - if (root.Handlebars === Handlebars) { - root.Handlebars = $Handlebars; - } - }; - }; - - module.exports = exports['default']; - /* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }()))) - -/***/ }, -/* 11 */, -/* 12 */, -/* 13 */, -/* 14 */ -/***/ function(module, exports, __webpack_require__) { - - var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(3)], __WEBPACK_AMD_DEFINE_RESULT__ = function(Handlebars) { - // Handlebars helpers - Handlebars.registerHelper('concat', function() { - var size = (arguments.length - 1), - output = ''; - for(var i = 0; i < size; i++) { - output += arguments[i]; - }; - return output; - }); - - Handlebars.registerHelper('number_format', function(value, block) { - return Number(value).toLocaleString(); - }); - Handlebars.registerHelper('date_format', function(timestamp, block) { - if(window.moment) { - if(timestamp === undefined || isNaN(timestamp) || timestamp <= 0) { - return; - } - - // set date format - var f = block.hash.format || "MMM Do, YYYY"; - // check if we passed a timestamp - if(parseInt(timestamp, 10) == timestamp) { - return moment.unix(timestamp).format(f); - } else { - return moment.utc(timestamp).format(f); - } - } else { - return timestamp; - }; - }); - - Handlebars.registerHelper('cycle', function(value, block) { - var values = value.split(' '); - return values[block.data.index % (values.length + 1)]; - }); - - Handlebars.registerHelper('ifCond', function (v1, operator, v2, options) { - switch (operator) { - case '==': - return (v1 == v2) ? options.fn(this) : options.inverse(this); - case '===': - return (v1 === v2) ? options.fn(this) : options.inverse(this); - case '!=': - return (v1 != v2) ? options.fn(this) : options.inverse(this); - case '!==': - return (v1 !== v2) ? options.fn(this) : options.inverse(this); - case '<': - return (v1 < v2) ? options.fn(this) : options.inverse(this); - case '<=': - return (v1 <= v2) ? options.fn(this) : options.inverse(this); - case '>': - return (v1 > v2) ? options.fn(this) : options.inverse(this); - case '>=': - return (v1 >= v2) ? options.fn(this) : options.inverse(this); - case '&&': - return (v1 && v2) ? options.fn(this) : options.inverse(this); - case '||': - return (v1 || v2) ? options.fn(this) : options.inverse(this); - case 'in': - var values = v2.split(','); - return (v2.indexOf(v1) !== -1) ? options.fn(this) : options.inverse(this); - default: - return options.inverse(this); - } - }); - - Handlebars.registerHelper('nl2br', function(value, block) { - return value.gsub("\n", "
"); - }); - - Handlebars.registerHelper('json_encode', function(value, block) { - return JSON.stringify(value); - }); - - Handlebars.registerHelper('json_decode', function(value, block) { - return JSON.parse(value); - }); - Handlebars.registerHelper('url', function(value, block) { - var url = window.location.protocol + "//" + window.location.host + window.location.pathname; - - return url + value; - }); - Handlebars.registerHelper('emailFromMailto', function(value) { - var mailtoMatchingRegex = /^mailto\:/i; - if (typeof value === 'string' && value.match(mailtoMatchingRegex)) { - return value.replace(mailtoMatchingRegex, ''); - } else { - return value; - } - }); - Handlebars.registerHelper('lookup', function(obj, field, options) { - return obj && obj[field]; - }); - - - Handlebars.registerHelper('rsa_key', function(value, block) { - // extract all lines into an array - if(value === undefined) return ''; - - var lines = value.trim().split("\n"); - - // remove header & footer - lines.shift(); - lines.pop(); - - // return concatenated lines - return lines.join(''); - }); - - Handlebars.registerHelper('trim', function(value, block) { - if(value === null || value === undefined) return ''; - return value.trim(); - }); - - /** - * {{ellipsis}} - * From: https://github.com/assemble/handlebars-helpers - * @author: Jon Schlinkert - * Truncate the input string and removes all HTML tags - * @param {String} str The input string. - * @param {Number} limit The number of characters to limit the string. - * @param {String} append The string to append if charaters are omitted. - * @return {String} The truncated string. - */ - Handlebars.registerHelper('ellipsis', function (str, limit, append) { - if (append === undefined) { - append = ''; - } - var sanitized = str.replace(/(<([^>]+)>)/g, ''); - if (sanitized.length > limit) { - return sanitized.substr(0, limit - append.length) + append; - } else { - return sanitized; - } - }); - - Handlebars.registerHelper('getNumber', function (string) { - return parseInt(string, 10); - }); - }.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); - - -/***/ } -/******/ ]); \ No newline at end of file diff --git a/lib/Router/Router.php b/lib/Router/Router.php index 9e01381a84..76100c7bf3 100644 --- a/lib/Router/Router.php +++ b/lib/Router/Router.php @@ -25,7 +25,7 @@ class Router { $method = $_POST['method']; $args = $_POST['args']; $endpoint = new $endpoint(); - $endpoint->$method(json_encode($args)); + $endpoint->$method($args); } function setToken() { diff --git a/views/layout.html b/views/layout.html index 02f8327829..224af6401d 100644 --- a/views/layout.html +++ b/views/layout.html @@ -23,9 +23,9 @@ <%= javascript( - 'src/vendor.js', - 'src/mailpoet.js', - 'src/admin.js' + 'vendor.js', + 'mailpoet.js', + 'admin.js' )%> diff --git a/webpack.config.js b/webpack.config.js index 9ac69e96dd..17bd98326b 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -13,7 +13,7 @@ baseConfig = { admin: 'admin.js', }, output: { - path: './assets/js/src', + path: './assets/js', filename: '[name].js', }, plugins: [ @@ -36,12 +36,12 @@ baseConfig = { resolve: { modulesDirectories: [ 'node_modules', - 'assets/js', + 'assets/js/src', 'assets/css/lib' ], fallback: path.join(__dirname, 'node_modules'), alias: { - 'handlebars': 'handlebars/runtime.js' + 'handlebars': 'handlebars/dist/handlebars.js' } }, resolveLoader: { @@ -71,13 +71,14 @@ module.exports = [ resolve: { modulesDirectories: [ 'node_modules', - 'assets/js', + 'assets/js/src', 'tests/javascript/newsletter_editor' ], fallback: path.join(__dirname, 'node_modules'), alias: { - 'handlebars': 'handlebars/runtime.js' + 'handlebars': 'handlebars/dist/handlebars.js' } }, + plugins: [], }) ];