Plugin Directory

Changeset 2024659


Ignore:
Timestamp:
02/04/2019 02:37:57 PM (7 years ago)
Author:
platformlycom
Message:

support for a new WordPress Editor;New features for the new WP Editor (platform.ly events)

Location:
platformly/trunk
Files:
1 added
6 edited

Legend:

Unmodified
Added
Removed
  • platformly/trunk/css/editor_btn.css

    r1955138 r2024659  
    4040    padding: 0 15px !important;
    4141}
     42.platform_ly_link_button_new{
     43    padding: 5px;
     44    border-radius: 4px;
     45    height: 30px;
     46    width: 30px;
     47    margin: 0;
     48}
     49.platform_ly_link_button_new i{
     50    display: inline-block;
     51    width: 20px;
     52    height: 20px;
     53    background-size: cover;
     54}
     55.platform_ly_link_button_new:hover{
     56    color: #555d66;
     57    box-shadow: inset 0 0 0 1px #555d66,inset 0 0 0 2px #fff;
     58}
     59#ply-block-btns{
     60    text-align: center;
     61    margin-bottom: 15px;
     62}
     63#ply-block-btns .ply-btn-etitor-block{
     64    display: inline-block;
     65    width: 40%;
     66    border: 1px solid #dfdfdf;
     67    padding: 10px 0;
     68    cursor: pointer;
     69    margin: 0 5px;
     70}
     71#ply-block-btns .ply-btn-etitor-block:hover{
     72    border-color: #b0b0b0;
     73}
     74.ply-editor-list-event-options{
     75    position: relative;
     76    display: inline-block;
     77    vertical-align: middle;
     78}
     79.ply-editor-dropdown-menu{
     80    position: absolute;
     81    top: 100%;
     82    left: -55px;
     83    z-index: 1000;
     84    display: none;
     85    float: left;
     86    min-width: 160px;
     87    padding: 5px 0;
     88    margin: 2px 0 0;
     89    font-size: 14px;
     90    text-align: left;
     91    list-style: none;
     92    background-color: #fff;
     93    -webkit-background-clip: padding-box;
     94    background-clip: padding-box;
     95    border: 1px solid #ccc;
     96    border: 1px solid rgba(0,0,0,.15);
     97    border-radius: 4px;
     98    -webkit-box-shadow: 0 6px 12px rgba(0,0,0,.175);
     99    box-shadow: 0 6px 12px rgba(0,0,0,.175);
     100}
     101.ply-editor-list-event-options .ply-link-more{
     102    cursor: pointer;
     103}
     104.ply-editor-list-event-options .ply-link-more:hover{
     105    color: #333;
     106    text-decoration: none;
     107}
     108.ply-editor-list-event-options.open .ply-editor-dropdown-menu{
     109    display: block;
     110}
     111#ply-default-event-msg{
     112    text-align: center;
     113    padding: 15px;
     114}
     115#ply-dialog-footer{
     116    display: none;
     117    padding: 0 16px 16px 16px;
     118    border-top: 1px solid #dfdfdf;
     119    position: absolute;
     120    bottom: 57px;
     121    background: #ffffff;
     122}
     123#ply-dialog-event-close-footer{
     124    text-align: right;
     125}
     126#ply-dialog-event-close-footer span{
     127    display: inline-block;
     128    width: 20px;
     129    height: 22px;
     130    transform:rotate(90deg);
     131    cursor: pointer;
     132    font-size: 20px;
     133    margin-right: -13px;
     134}
  • platformly/trunk/inc/ply.btn.php

    r1955138 r2024659  
     1<?php
     2    $projectCodeInclude = get_option('ply_project_code_active');
     3    $projectCode = ply_get_project_code();
     4?>
    15<div id="ply-add-link-dialog" class="hidden" style="max-width:600px;max-height: 500px;">
    26    <div>Loading . . .</div>
    37</div>
    48<script type="text/javascript">
     9    <?php if(!empty($projectCodeInclude) && !empty($projectCode)): ?>
     10        var plyProjectMsg = "A code from Project '<span class='ply-project-name'></span>' is being used on this site.";
     11        var plyProjectId = '<?php echo $projectCode['ply_project_id'] ?>';
     12    <?php else: ?>
     13        var plyProjectMsg = 'You must include a Platform.ly project code within your site, please <a href="<?php echo get_admin_url(null, 'admin.php?page=ply') ?>">"click here"</a> to do it now.';
     14        var plyProjectId = 0;
     15    <?php endif; ?>
    516    jQuery(function () {
    617        // initalise the dialog
     
    1526            closeOnEscape: true,
    1627            maxHeight: 500,
     28            dialogClass: "ply-dialog-editor",
    1729            position: {
    1830                my: "center",
     
    2335                $('.ui-widget-overlay').bind('click', function () {
    2436                    closePlyDialog();
    25                 })
     37                });
     38                $('.ui-widget-content').bind('click', function () {
     39                    $('.ply-editor-list-event-options').removeClass('open');
     40                });
     41                $('.ui-dialog-buttonpane button:contains("Add Link")').button().hide();
     42                $('.ui-dialog-buttonpane button:contains("Add on Page")').button().hide();
     43                $('.ui-dialog-buttonpane button:contains("Add on Link Click")').button().hide();
     44                $('.ui-dialog-buttonpane button:contains("Copy Code")').button().hide();
     45                $('.ui-dialog-buttonpane button:contains("Edit Event")').button().hide();
     46                $('.ui-dialog-buttonpane button:contains("Remove Event")').button().hide();
    2647            },
    2748            create: function () {
    2849                $('.ui-dialog-titlebar-close').addClass('ui-button');
     50                $('.ply-dialog-editor .ui-dialog-buttonpane').before('<div id="ply-dialog-footer"></div>');
    2951            },
    3052            buttons: [{
    3153                    text: "Add Link",
    32                     click: function () {
     54                    click: function() {
    3355                        var enteredUrl = jQuery('.chosenCustomLink:checked').val();
    34                         if (typeof enteredUrl !== 'undefined' && enteredUrl.length > 0) {
    35                             if (enteredUrl == 'custom_tracking') {
    36                                 enteredUrl = jQuery('.chosenCustomLink:checked').data('mainlink') + '?' + (($("#trc1").val() != '') ? '&c1=' + $("#trc1").val() : '') + (($("#trc2").val() != '') ? '&c2=' + $("#trc2").val() : '') + (($("#trc3").val() != '') ? '&c3=' + $("#trc3").val() : '') + (($("#trc4").val() != '') ? '&c4=' + $("#trc4").val() : '');
     56                        if(typeof wp.richText !== 'undefined'){
     57                            if(typeof enteredUrl !== 'undefined' && enteredUrl.length > 0){
     58                                if(enteredUrl == 'custom_tracking') {
     59                                    enteredUrl = jQuery('.chosenCustomLink:checked').data('mainlink') + '?' + (($("#trc1").val() != '') ? '&c1=' + $("#trc1").val() : '') + (($("#trc2").val() != '') ? '&c2=' + $("#trc2").val() : '') + (($("#trc3").val() != '') ? '&c3=' + $("#trc3").val() : '') + (($("#trc4").val() != '') ? '&c4=' + $("#trc4").val() : '');
     60                                }
     61                                if(plySelectedWord.value.start == plySelectedWord.value.end){
     62                                    var newElement = wp.richText.insert(plySelectedWord.value, enteredUrl);
     63                                    plySelectedWord.onChange(newElement);
     64                                    newElement.start = plySelectedWord.value.start;
     65                                    plySelectedWord.onChange(wp.richText.applyFormat(newElement, {
     66                                        type: 'core/link',
     67                                        attributes: {
     68                                            url: enteredUrl,
     69                                        }
     70                                    }));
     71                                }else{
     72                                    plySelectedWord.onChange(wp.richText.applyFormat(plySelectedWord.value, {
     73                                        type: 'core/link',
     74                                        attributes: {
     75                                            url: enteredUrl,
     76                                        }
     77                                    }));
     78                                }
     79                                closePlyDialog();
     80                            }else{
     81                                alert("Your Link can't be empty.");
    3782                            }
    38                             if (typeof window.tinymce !== 'undefined' && !tinymce.activeEditor.isHidden()) {
    39                                 var selectedText = tinymce.activeEditor.selection.getContent();
    40                                 if (selectedText.length < 1) {
    41                                     selectedText = enteredUrl;
    42                                 }
    43                                 tinymce.activeEditor.insertContent('<a href="' + enteredUrl + '">' + selectedText + '</a>');
    44                             } else {
    45                                 var selectedText = getSelected();
    46                                 if (selectedText.length < 1) {
    47                                     selectedText = enteredUrl;
    48                                 }
    49                                 QTags.insertContent('<a href="' + enteredUrl + '">' + selectedText + '</a>');
     83                        }else{
     84                            if(typeof enteredUrl !== 'undefined' && enteredUrl.length > 0){
     85                                if (enteredUrl == 'custom_tracking') {
     86                                    enteredUrl = jQuery('.chosenCustomLink:checked').data('mainlink') + '?' + (($("#trc1").val() != '') ? '&c1=' + $("#trc1").val() : '') + (($("#trc2").val() != '') ? '&c2=' + $("#trc2").val() : '') + (($("#trc3").val() != '') ? '&c3=' + $("#trc3").val() : '') + (($("#trc4").val() != '') ? '&c4=' + $("#trc4").val() : '');
     87                                }
     88                                if (typeof window.tinymce !== 'undefined' && !tinymce.activeEditor.isHidden()) {
     89                                    var selectedText = tinymce.activeEditor.selection.getContent();
     90                                    if (selectedText.length < 1) {
     91                                        selectedText = enteredUrl;
     92                                    }
     93                                    tinymce.activeEditor.insertContent('<a href="' + enteredUrl + '">' + selectedText + '</a>');
     94                                } else {
     95                                    var selectedText = getSelected();
     96                                    if (selectedText.length < 1) {
     97                                        selectedText = enteredUrl;
     98                                    }
     99                                    QTags.insertContent('<a href="' + enteredUrl + '">' + selectedText + '</a>');
     100                                }
     101                                closePlyDialog();
     102                            }else{
     103                                alert("Your Link can't be empty.");
     104                            }
     105                        }
     106                    },
     107                    "class": 'button button-primary'
     108                },
     109                {
     110                    text: "Add on Page",
     111                    click: function() {
     112                        var id = jQuery('.chosenEvent:checked').val();
     113                        if(typeof id !== 'undefined' && id.length > 0){
     114                            var selectedEvent = jQuery('.chosenEvent:checked').parents('tr');
     115                            var description = selectedEvent.find('.existing-description').text();
     116                            var action = selectedEvent.find('.existing-action span').text();
     117                            var eventCode = "<script type='text/javascript'>plyt('"+action.replace(/[^a-zA-Z0-9_ ]/gi, "")+"', '"+description.replace(/[^a-zA-Z0-9_ ]/gi, "")+"','"+encodeURIComponent(id)+"');<\/script>";
     118                            insertedBlock = wp.blocks.createBlock('core/html', {
     119                                content: eventCode,
     120                            });
     121                            wp.data.dispatch('core/editor').insertBlocks(insertedBlock, 0);
     122                            closePlyDialog();
     123                        }else{
     124                            alert("Please select event");
     125                        }
     126                    },
     127                    "class": 'button button-primary'
     128                },
     129                {
     130                    text: "Add on Link Click",
     131                    click: function() {
     132                        var id = jQuery('.chosenEvent:checked').val();
     133                        if(typeof id !== 'undefined' && id.length > 0){
     134                            var selectedEvent = jQuery('.chosenEvent:checked').parents('tr');
     135                            var description = selectedEvent.find('.existing-description').text();
     136                            var action = selectedEvent.find('.existing-action span').text();
     137                            var eventCodeClick = "plyt('"+action.replace(/[^a-zA-Z0-9_ ]/gi, "")+"', '"+description.replace(/[^a-zA-Z0-9_ ]/gi, "")+"','"+encodeURIComponent(id)+"');";
     138                            if(Object.keys(plySelectedWord).length > 0){
     139                                var activeLink = wp.richText.getActiveFormat(plySelectedWord.value, 'core/link');
     140                                var attributes = {
     141                                        url: 'javascript:;',
     142                                        onclick: eventCodeClick
     143                                    }
     144                                if(typeof activeLink !== 'undefined'){
     145                                    attributes.url = activeLink.attributes.url;
     146                                    if(typeof activeLink.attributes.target !== 'undefined'){
     147                                        attributes.target = activeLink.attributes.target;
     148                                    }
     149                                }
     150                                plySelectedWord.onChange(wp.richText.applyFormat(plySelectedWord.value, {
     151                                    type: 'core/link',
     152                                    attributes: attributes
     153                                }));
     154                            }else if(Object.keys(plyEventButton).length > 0){
     155                                plyEventButton.setAttributes({onclick: eventCodeClick});
    50156                            }
    51157                            closePlyDialog();
    52                         } else {
    53                             alert("Your Link can't be empty.");
    54                         }
    55                     },
    56                     "class": 'button button-primary'
    57                 }, {
    58                     text: "Cansel",
     158                        }else{
     159                            alert("Please select event");
     160                        }
     161                    },
     162                    "class": 'button button-primary'
     163                },
     164                {
     165                    text: "Copy Code",
     166                    click: function(){
     167                        var id = jQuery('.chosenEvent:checked').val();
     168                        if(typeof id !== 'undefined' && id.length > 0){
     169                            var selectedEvent = jQuery('.chosenEvent:checked').parents('tr');
     170                            var description = selectedEvent.find('.existing-description').text();
     171                            var action = selectedEvent.find('.existing-action span').text();
     172                            var eventCodeClick = "plyt('"+action.replace(/[^a-zA-Z0-9_ ]/gi, "")+"', '"+description.replace(/[^a-zA-Z0-9_ ]/gi, "")+"','"+encodeURIComponent(id)+"');";
     173                            var eventCode = "<script type='text/javascript'>plyt('"+action.replace(/[^a-zA-Z0-9_ ]/gi, "")+"', '"+description.replace(/[^a-zA-Z0-9_ ]/gi, "")+"','"+encodeURIComponent(id)+"');<\/script>";
     174                            $("#eventType").val(1).trigger('change');
     175                            $("#evCode_bottom_click").val(eventCodeClick);
     176                            $("#evCode_bottom").val(eventCode);
     177                            $('#ply-dialog-footer').toggle();
     178                        }else{
     179                            alert("Please select event");
     180                        }
     181                    },
     182                    "class": 'button button-primary'
     183                },
     184                {
     185                    text: "Edit Event",
     186                    click: function(){
     187                        $('.ui-dialog-buttonpane button:contains("Edit Event")').button().hide();
     188                        $('.ui-dialog-buttonpane button:contains("Remove Event")').button().hide();
     189                        get_ply_projects();
     190                    },
     191                    "class": 'button button-primary'
     192                },
     193                {
     194                    text: "Remove Event",
     195                    click: function(){
     196                        //console.log(plyEventButton);
     197                        delete plyEventButton.attributes.onclick;
     198                        closePlyDialog();
     199                    },
     200                    "class": 'button button-primary'
     201                },
     202                {
     203                    text: "Cancel",
    59204                    click: function () {
    60205                        closePlyDialog();
     
    63208        });
    64209    });
    65     QTags.addButton('platform_ly_link', 'Platform.ly', add_platform_ly_link);
     210    QTags.addButton('platform_ly_link', 'Platform.ly', showPlyDialogOptions);
     211   
     212    function getBlockDOMNode(clientId){
     213        document.querySelector('[data-block="' + clientId + '"]');
     214    }
    66215</script>
    67216
  • platformly/trunk/js/editor_btn.js

    r1955138 r2024659  
    55            icon: 'icon platform_ly_link_button',
    66            onclick: function(){
    7                 add_platform_ly_link()
     7                showPlyDialogOptions()
    88            }
    99        });
  • platformly/trunk/js/ply_add_link_functions.js

    r1998157 r2024659  
    11plyAddLinkDialog = '<div id="ply-add-link-dialog" class="hidden" style="max-width:800px"></div>';
    22plySearchWord = '';
     3plySelectedWord = {};
     4plyEventButton = {};
    35function get_ply_tracking_links(){
     6    $('#ply-add-link-dialog').html('<div>Loading . . .</div>');
    47    jQuery.post(ajaxurl, {action: 'ply_get_tracking_links'}, function(response){
     8        $('.ui-dialog-buttonpane button:contains("Add Link")').button().hide();
    59        var data = JSON.parse(response);
    610        if(data.status!='success'){
     
    3539            if(plySearchWord){
    3640                $('#ply_links_table_search').val(plySearchWord).keyup();
    37         }
     41            }
    3842            $('#ply-add-link-dialog').on('keyup', '#ply_links_table_search', function(){
    3943                $('#links_table_toggle tr').removeClass('ply_search_has_result');
     
    4246                var lowerPlySearchWord = plySearchWord.toLowerCase();
    4347                $('#links_table_toggle td.ply_search_link').each(function(){
    44                     if($(this).text().toLowerCase().indexOf(lowerPlySearchWord) < 0){
    45                         if(!$(this).parent('tr').hasClass('ply_search_has_result')){
     48                if($(this).text().toLowerCase().indexOf(lowerPlySearchWord) < 0){
     49                    if(!$(this).parent('tr').hasClass('ply_search_has_result')){
    4650                            $(this).parent('tr').addClass('ply_serch_not_result');
    4751                        }
     
    4953                        $(this).parent('tr').addClass('ply_search_has_result').removeClass('ply_serch_not_result');
    5054                    }
    51     });
     55                });
    5256            });
    5357            $('#ply-add-link-dialog').dialog({width: '600px'}).position({ my: "center", at: "center", of: window });
    54 }
     58        }
    5559    });
    5660}
    5761function load_trackingLinks_inDetails(id){
     62    $('#ply-add-link-dialog').html('<div>Loading . . .</div>');
    5863    jQuery.post(ajaxurl, {action: 'ply_get_tracking_links_details', id: id}, function(response){
    5964        var data = JSON.parse(response);
     
    8287            $('#ply-add-link-dialog').html(table);
    8388            $('#ply-add-link-dialog').dialog('widget').position({ my: "center", at: "center", of: window });
     89            $('.ui-dialog-buttonpane button:contains("Add Link")').button().show();
    8490        }else{
    8591            if(data.status == 'not_found'){
     
    98104}
    99105function add_platform_ly_link(){
    100     $('#ply-add-link-dialog').dialog('open');
     106    //$('#ply-add-link-dialog').dialog('open');
    101107    get_ply_tracking_links();
    102108}
    103109function closePlyDialog(){
    104110    $('#ply-add-link-dialog').dialog('close');
    105     $('#ply-add-link-dialog').html('<div>Loading . . .</div>');
    106 }
     111    $('#ply-dialog-footer').hide();
     112    $('#ply-add-link-dialog').html('<div>Loading . . .</div>');
     113}
     114function showPlyDialogOptions(){
     115    if(typeof wp.richText === 'undefined'){
     116        $('#ply-add-link-dialog').dialog('open');
     117        get_ply_tracking_links();
     118    }else{
     119        $('#ply-add-link-dialog').dialog('open');
     120        $('#ply-add-link-dialog').dialog({width: '600px'}).position({ my: "center", at: "center", of: window });
     121        var options = '<div id="ply-block-btns"><div class="ply-btn-etitor-block" onclick="get_ply_tracking_links()">Add a tracking link</div><div class="ply-btn-etitor-block" onclick="get_ply_projects()">Add an event</div></div>';
     122        $('#ply-add-link-dialog').html(options);
     123    }
     124}
     125function get_ply_projects(){
     126    var projectList = '<option value="-1">Please choose...</option>';
     127    //var plyMsgIncludeProject = '<p class="ply-project-msg ply_successMsg">'+plyProjectMsg+'</p>';
     128    //ply-project-name
     129    $('#ply-add-link-dialog').html('<div>Loading . . .</div>');
     130    jQuery.post(ajaxurl, {'action': 'ply_get_projects'}, function(response){
     131        var data = JSON.parse(response);
     132        for(var key in data) {
     133            projectList += '<option value="'+key+'">'+data[key]+'</option>';
     134        }
     135        if(plyProjectId > 0){
     136            var plyMsgIncludeProject = '<p class="ply-project-msg ply_successMsg" style="margin-top: 0;">A code from Project \'<span>'+data[plyProjectId]+'</span>\' is being used on this site.</p>';
     137        }else{
     138            var plyMsgIncludeProject = '<p class="ply-project-msg ply_errorMsg" style="margin-top: 0;">'+plyProjectMsg+'</p>';
     139        }
     140        $('#ply-add-link-dialog').html("<div>"+plyMsgIncludeProject+"<select id='ply-project-select'>"+projectList+"</select></div><div id='ply-events-block'><div id='ply-default-event-msg'>Please select project</div></div>");
     141    });
     142}
     143function get_ply_events(projectId){
     144    if(projectId == -1){
     145        return;
     146    }
     147    $('.ui-dialog-buttonpane button:contains("Add on Page")').button().hide();
     148    $('.ui-dialog-buttonpane button:contains("Add on Link Click")').button().hide();
     149    $('.ui-dialog-buttonpane button:contains("Copy Code")').button().hide();
     150    jQuery('#ply-add-link-dialog #ply-events-block').html('<div id="ply-default-event-msg">Loading...</div></div>');
     151    jQuery.post(ajaxurl, {'action': 'ply_load_events','projectId': projectId}, function(response){
     152        var data = JSON.parse(response);
     153        if(data.status!='success'){
     154            if(data.status == 'not_found'){
     155                $('#ply-add-link-dialog #ply-events-block').html('<div id="ply-default-event-msg">Please go to settings and enter your API Key first.</div>');
     156            }else{
     157                $('#ply-add-link-dialog #ply-events-block').html('<div id="ply-default-event-msg">'+data.status+'</div>');
     158            }
     159        }else{
     160            if(data.events.length > 0){
     161                var tbody = '';
     162                for(var key in data.events) {
     163                    var listOptions = '';
     164                    if(jQuery.isPlainObject(data.events[key]['decode_options']) && Object.keys(data.events[key]['decode_options']).length > 1){
     165                        listOptions = '<div class="ply-editor-list-event-options">\n\
     166                            <a type="button" class="ply-link-more" data-toggle="dropdown" style="padding: 0">\n\
     167                                view more\n\
     168                            </a>\n\
     169                            <ul class="ply-editor-dropdown-menu" role="menu" style="padding: 5px 10px;">\n\
     170                                '+data.events[key]['view_options']+'\n\
     171                            </ul>\n\
     172                        </div>';
     173                    }
     174                    var custom_action = data.events[key]['custom_action'] ? "("+data.events[key]['custom_action']+")" : "";
     175                    if(data.events[key]['first_options']){
     176                        var first_options = data.events[key]['first_options'];
     177                    }else{
     178                        var first_options = '-';
     179                    }
     180                    tbody += '<tr>\n\
     181                                <td style="text-align: center"><input type="radio"  style="width:auto" class="chosenEvent" name="chosenEvent" value="'+data.events[key]['id']+'"/></td>\n\
     182                                <td style="font-size:12px;">'+data.events[key]['formatted_date']+'</td>\n\
     183                                <td class="existing-action" style="font-size:12px;"><span>'+data.events[key]['action']+'</span>'+custom_action+'</td>\n\
     184                                <td class="existing-description" style="font-size:12px;">'+data.events[key]['description']+'</td>\n\
     185                                <td style="font-size:12px; text-align:left">'+first_options+'<br/>'+listOptions+'</td>\n\
     186                            </tr>';
     187                }
     188                var table = '<table id="links_table_toggle">\n\
     189                    <thead>\n\
     190                         <th style="width: 40px;">Select</th>\n\
     191                        <th>Date</th>\n\
     192                        <th>Action</th>\n\
     193                        <th>Description</th>\n\
     194                        <th>Options</th>\n\
     195                    </thead>\n\
     196                    <tbody>'+tbody+'</tbody>\n\
     197                    </table>';
     198                var eventCode = '<div id="ply-dialog-event-close-footer"><span>&#187;</span></div><div><p style="margin-top: 0;">Place below code where you want to fire the event. The events can be fired in any HTML code, onClick,onChange events, JS functions...</p>\n\
     199                                <div style="margin-bottom: 10px;width: 100%;">\n\
     200                                    <select id="eventType" style="width: 100%;" class="form-control">\n\
     201                                        <option value="1" selected>Add on Page</option>\n\
     202                                        <option value="2">Add on Link or Button</option>\n\
     203                                    </select>\n\
     204                                </div>\n\
     205                                <div id="eventCodeBlock">\n\
     206                                    <textarea name="evCode_bottom" id="evCode_bottom" class="form-control" onclick="jQuery(this).select()" style="width: 100%;background-color:#f4f4f4;  font-size:12px;"></textarea>\n\
     207                                    <textarea name="evCode_bottom_click" id="evCode_bottom_click" class="form-control" onclick="jQuery(this).select()" style="width: 100%;background-color:#f4f4f4;  font-size:12px;"></textarea>\n\
     208                                </div></div>';
     209                $('#ply-add-link-dialog #ply-events-block').html(table);
     210                $('#ply-dialog-footer').html(eventCode);
     211                $('.ui-dialog-buttonpane button:contains("Add on Page")').button().show();
     212                $('.ui-dialog-buttonpane button:contains("Add on Link Click")').button().show();
     213                $('.ui-dialog-buttonpane button:contains("Copy Code")').button().show();
     214            }else{
     215                $('#ply-add-link-dialog #ply-events-block').html("<div id='ply-default-event-msg'>You haven't created an Event for this project yet.</div>");
     216            }
     217            $('#ply-add-link-dialog').dialog({width: '600px'}).position({ my: "center", at: "center", of: window });
     218        }
     219    });
     220}
     221function showPlyDialogOnlyEventOptions(){
     222    $('#ply-add-link-dialog').dialog('open');
     223    $('#ply-add-link-dialog').dialog({width: '600px'}).position({ my: "center", at: "center", of: window });
     224    //console.log(plyEventButton);
     225    if(typeof plyEventButton.attributes.onclick !== 'undefined' && plyEventButton.attributes.onclick != ''){
     226        $('.ui-dialog-buttonpane button:contains("Edit Event")').button().show();
     227        $('.ui-dialog-buttonpane button:contains("Remove Event")').button().show();
     228        $('#ply-add-link-dialog').html("There's existing event for this button. Choose one of the following action.");
     229        $('#ply-add-link-dialog').dialog({width: '600px'}).position({ my: "center", at: "center", of: window });
     230    }else{
     231        get_ply_projects();
     232    }
     233}
     234
     235jQuery(document).on('click', '.ply-link-more', function(){
     236    //$('.ply-editor-list-event-options').removeClass('open');
     237    $(this).parent().addClass('open');
     238});
     239jQuery(document).on('change', '#ply-project-select', function(){
     240    var projectId = $(this).val();
     241    $('#ply-dialog-footer').hide();
     242    get_ply_events(projectId);
     243});
     244jQuery(document).on('change', '#eventType', function(){
     245    if($(this).val() == 1){
     246        $('#evCode_bottom_click').hide();
     247        $('#evCode_bottom').show();
     248    }else{
     249        $('#evCode_bottom').hide();
     250        $('#evCode_bottom_click').show();
     251    }
     252});
     253jQuery(document).on('click', '#ply-dialog-event-close-footer span', function(){
     254    $('#ply-dialog-footer').hide();
     255});
  • platformly/trunk/platformly.php

    r1998157 r2024659  
    44Plugin Name: Platform.ly Official
    55Description: Platform.ly plugin is the easiest way to setup your optins and pages that your created with Platform.ly. After building your optin or page with our interactive WYSIWYG builders, you can set them up to show on your site with just a couple of clicks.
    6 Version: 1.3
     6Version: 1.4
    77Author: Platform.ly
    88Author URI: https://www.platform.ly/
     
    169169add_action('wp_ajax_ply_remove_project_code', 'ply_remove_project_code_callback');
    170170add_action('wp_ajax_ply_project_code_include', 'ply_project_code_include_callback');
     171add_action('wp_ajax_ply_get_projects', 'ply_get_projects_callback');
    171172
    172173function ply_load_optins_callback(){
     
    250251    $includeCode = isset($_POST['includeCode']) && !empty($_POST['includeCode']) ? true : false;
    251252    ply_project_code_include($includeCode);
     253    wp_die();
     254}
     255
     256function ply_get_projects_callback(){
     257    $result = wp_remote_get(PLATFORMLY_URL."/plugin/plugin.actions.php?plugin_key=".ply_get_plugin_key()."&action=listProjects");
     258    $result = wp_remote_retrieve_body($result);
     259    echo $result;
    252260    wp_die();
    253261}
     
    393401}
    394402add_action('wp_head', 'platform_ly_set_project_code');
     403
     404function ply_test_new_editor(){
     405    wp_enqueue_script('ply-add-link-new', plugin_dir_url(__FILE__).'js/ply_editor_btn_functions.js', array('wp-blocks', 'wp-editor', 'wp-components', 'wp-i18n', 'wp-element', 'wp-rich-text', 'wp-format-library'));
     406}
     407
     408add_action('enqueue_block_editor_assets', 'ply_test_new_editor');
    395409?>
  • platformly/trunk/readme.txt

    r1998157 r2024659  
    33Tags: crm, custom pages, optin forms, event, tracking link, Platform.ly, platform, platform.ly
    44Requires at least: 4.6
    5 Tested up to: 4.9.8
     5Tested up to: 5.0.3
    66Requires PHP: 5.5.9
    77Stable tag: trunk
     
    6363== Upgrade Notice ==
    6464
     65= 1.4 =
     66- support for a new WordPress Editor
     67- New features for the new WP Editor (platform.ly events)
     68
    6569= 1.3 =
    6670- new feature for automatic adding the project code in the site header.
Note: See TracChangeset for help on using the changeset viewer.