Plugin Directory

Changeset 3284680


Ignore:
Timestamp:
04/30/2025 07:54:34 AM (11 months ago)
Author:
postology
Message:

'widgetvisiblity'

Location:
postology/trunk
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • postology/trunk/assets/css/postology-style.css

    r3268387 r3284680  
    11/* Postology Styles */
    22@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:ital,wght@0,200..800;1,200..800&display=swap');
    3 
    4 /* Main Container */
    5 #postology-box {
    6     position: relative !important;
    7     display: flex !important;
    8     align-items: center !important;
    9     justify-content: space-between !important;
    10     flex-wrap: nowrap !important;
    11     width: 100% !important;
    12     box-sizing: border-box !important;
    13     margin-bottom: 30px !important;
    14     padding: 9px 12px !important;
    15     overflow: hidden !important;
    16     font-family: "Plus Jakarta Sans", serif;
    17 
    18     /* Header Text */
    19     .postology-header {
    20         flex-grow: 1 !important;
    21         overflow: hidden !important;
    22         display: flex !important;
    23         align-items: center !important;
    24     }
    25 
    26     p {
    27         margin-block: auto !important;
    28         font-weight: 600 !important;
    29     }
    30 
    31     /* Generate Summary Button */
    32     #generate-summary {
    33         display: flex !important;
    34         align-items: center !important;
    35         justify-content: center !important;
    36         cursor: pointer !important;
    37         padding: 6px 20px !important;
    38         transition: background-color 0.3s, transform 0.3s, box-shadow 0.3s;
    39         white-space: nowrap !important;
    40 
    41         &:disabled {
    42             background-color: #9c9c9c !important;
    43             cursor: not-allowed !important;
    44             transform: translateY(0px) !important;
    45         }
    46         &:hover {
    47             transform: translateY(-2px) !important;
    48         }
    49     }
    50 }
    51 
    52 
    53 /* Icon */
    54 .icon {
    55     margin-right: 8px !important;
    56     width: 30px !important;
    57 }
    58 
    59 
    60 
    61 /* Summary Content */
    62 
    63 .nav-tab-disabled {
    64     color: #a0a5aa !important;
    65     cursor: not-allowed !important;
    66     text-decoration: none !important;
    67 
    68     &:hover {
    69         color: #a0a5aa !important;
    70     }
    71 }
    72 
    73 /* Summary Container */
    74 #summary-content {
    75     display: none;
    76     width: 100% !important;
    77     box-sizing: border-box !important;
    78     padding: 16px 16px 12px 16px;
    79     font-family: "Plus Jakarta Sans", serif;
    80     margin-block-end: 30px !important;
    81 
    82     /* Summary Title */
    83     #summary-title {
    84         display: flex !important;
    85         align-items: center !important;
    86         gap: 8px !important;
    87         margin-bottom: 15px !important;
    88 
    89         p {
    90             margin: 0 !important;
    91         }
    92     }
    93 
    94     #summary-content-placeholder {
    95         background-color: #a3a3a31f;
    96         border-radius: 12px !important;
    97         padding: 18px !important;
    98 
    99         ul {
    100             list-style-type: disc !important;
    101             padding-left: 20px !important;
    102             margin: 0 !important;
    103            
    104             li {
    105                 margin-bottom: 12px !important;
    106             }
    107         }
    108     }
    109 
    110     /* "Powered by Postology" Text */
    111     .postology-powered-by {
    112         font-size: 12px !important;
    113         color: #888888 !important;
    114         text-align: right !important;
    115         margin-top: 12px !important;
    116     }
    117 }
    118 
    119 /* Loading Placeholder */
    120 #loading-placeholder {
    121     display: none;
    122     padding: 20px !important;
    123     background-color: #fff !important;
    124 }
    125 
    126 /* Loading Lines */
    127 .loading-line {
    128     height: 10px !important;
    129     background: linear-gradient(120deg, #fdfbfb 0%, #ebedee 100%) !important;
    130     background-size: 200% 100% !important;
    131     margin-bottom: 10px !important;
    132     border-radius: 5px !important;
    133     animation: shimmer 1.5s infinite linear;
    134 }
    135 
    136 /* Mobile Styling */
    137 @media (max-width: 768px) {
    138     #postology-box {
    139         flex-direction: column !important;
    140         align-items: flex-start !important;
    141     }
    142 
    143     .postology-header {
    144         margin-bottom: 10px !important;
    145     }
    146 
    147     #generate-summary {
    148         width: 100% !important;
    149         margin-bottom: 10px !important;
    150     }
    151 }
    152 
    153 /* Animation Keyframes */
    154 @keyframes shimmer {
    155     0% {
    156         background-position: -200% 0;
    157     }
    158     100% {
    159         background-position: 200% 0;
    160     }
    161 }
  • postology/trunk/assets/css/settings.css

    r3268387 r3284680  
    33:root {
    44    --primary: #1063ef;
     5}
     6
     7.e-notice--extended,
     8.e-notice--dismissible,
     9.e-notice,
     10.notice {
     11    display: none !important;
    512}
    613
     
    1926    align-items: center;
    2027}
     28
     29.nav-tab-disabled {
     30    color: #a0a5aa;
     31    cursor: not-allowed;
     32    text-decoration: none;
     33
     34    &:hover {
     35        color: #a0a5aa;
     36    }
     37}
     38
    2139
    2240
     
    5674
    5775
    58 /*  postology box preview  */
    59 #preview-container {
    60     display: grid;
    61     grid-template-columns: auto 60%;
    62     align-items: start;
    63 
    64     padding-inline-end: 30px;
    65 
    66     .form-table {
    67         grid-row-start: 2;
    68     }
    69 
    70     .form-table:nth-of-type(2) th {
    71         display: none;
    72         padding: 0;
    73         inline-size: 0;
    74     }
    75 
    76     h2:nth-of-type(2) {
    77         grid-row: 1;
    78         grid-column: 2;
    79     }
    80 
    81     #postology_reset_styles {
    82         inline-size: fit-content;
    83     }
    84 
    85     .submit {
    86         grid-column: 1
    87     }
    88 }
     76
    8977
    9078/* Main Container */
    9179#postology-box {
    92     position: relative !important;
    93     display: flex !important;
    94     align-items: center !important;
    95     justify-content: space-between !important;
    96     flex-wrap: nowrap !important;
    97     width: 100% !important;
    98     box-sizing: border-box !important;
    99     margin-bottom: 30px !important;
    100     padding: 9px 12px !important;
    101     overflow: hidden !important;
     80    position: relative;
     81    display: flex;
     82    align-items: center;
     83    justify-content: space-between;
     84    flex-wrap: nowrap;
     85    width: 100%;
     86    box-sizing: border-box;
     87    padding: 9px 12px;
     88    overflow: hidden;
     89    margin-block-end: 30px;
    10290    font-family: "Plus Jakarta Sans", serif;
    10391
    10492    /* Header Text */
    10593    .postology-header {
    106         flex-grow: 1 !important;
    107         overflow: hidden !important;
    108         display: flex !important;
    109         align-items: center !important;
     94        flex-grow: 1;
     95        overflow: hidden;
     96        display: flex;
     97        align-items: center;
    11098    }
    11199
    112100    p {
    113         margin-block: auto !important;
    114         font-weight: 600 !important;
     101        margin-block: auto;
     102        font-weight: 600;
    115103    }
    116104
    117105    /* Generate Summary Button */
    118106    #generate-summary {
    119         display: flex !important;
    120         align-items: center !important;
    121         justify-content: center !important;
    122         cursor: pointer !important;
    123         padding: 6px 20px !important;
     107        display: flex;
     108        align-items: center;
     109        justify-content: center;
     110        cursor: pointer;
     111        padding: 6px 20px;
    124112        transition: background-color 0.3s, transform 0.3s, box-shadow 0.3s;
    125         white-space: nowrap !important;
     113        white-space: nowrap;
    126114
    127115        &:disabled {
    128             background-color: #9c9c9c !important;
    129             cursor: not-allowed !important;
    130             transform: translateY(0px) !important;
    131         }
    132 
     116            /* background-color: #9c9c9c; */
     117            cursor: not-allowed;
     118            transform: translateY(0px);
     119        }
    133120        &:hover {
    134             transform: translateY(-2px) !important;
    135         }
    136     }
    137 }
    138 
     121            transform: translateY(-2px);
     122        }
     123    }
     124}
     125
     126/* Summary Container */
     127#summary-content {
     128    width: 100%;
     129    box-sizing: border-box;
     130    padding: 16px 16px 12px 16px;
     131    font-family: "Plus Jakarta Sans", serif;
     132    margin-block-end: 30px;
     133
     134    /* Summary Title */
     135    #summary-title {
     136        display: flex;
     137        align-items: center;
     138        gap: 8px;
     139        margin-bottom: 15px;
     140
     141        p {
     142            margin: 0;
     143            font-size: inherit;
     144        }
     145    }
     146
     147    #summary-content-placeholder {
     148        background-color: #a3a3a3;
     149        border-radius: 9px;
     150        padding: 18px;
     151
     152        ul {
     153            list-style-type: disc;
     154            padding-left: 20px;
     155            margin: 0;
     156           
     157            li {
     158                margin-bottom: 12px;
     159            }
     160        }
     161    }
     162
     163    /* "Powered by Postology" Text */
     164    .postology-powered-by {
     165        font-size: 12px;
     166        color: #888888;
     167        text-align: right;
     168        margin-top: 12px;
     169    }
     170}
    139171
    140172/* Icon */
     
    144176}
    145177
    146 
    147 
    148 /* Summary Content */
    149 
    150 .nav-tab-disabled {
    151     color: #a0a5aa !important;
    152     cursor: not-allowed !important;
    153     text-decoration: none !important;
    154 
    155     &:hover {
    156         color: #a0a5aa !important;
    157     }
    158 }
    159 
    160 /* Summary Container */
    161 #summary-content {
    162     width: 100%;
    163     box-sizing: border-box !important;
    164     font-family: "Plus Jakarta Sans", serif;
    165     margin-block-end: 30px !important;
    166     padding: 16px 16px 12px 16px;
    167 
    168     /* Summary Title */
    169     #summary-title {
    170         display: flex !important;
    171         align-items: center !important;
    172         gap: 8px !important;
    173         margin-bottom: 15px !important;
    174 
    175         p {
    176             margin: 0 !important;
    177             font-size: inherit;
    178         }
    179     }
    180 
    181     #summary-content-placeholder {
    182         background-color: #a3a3a3;
    183         border-radius: 12px !important;
    184         padding: 18px !important;
    185 
    186         ul {
    187             list-style-type: disc !important;
    188             padding-left: 20px !important;
    189             margin: 0 !important;
    190 
    191             li {
    192                 margin-bottom: 12px !important;
    193             }
    194         }
    195     }
    196 
    197     /* "Powered by Postology" Text */
    198     .postology-powered-by {
    199         font-size: 12px !important;
    200         color: #888888;
    201         text-align: right !important;
    202         margin-top: 12px !important;
    203     }
    204 }
    205 
    206 /* Loading Placeholder */
    207 #loading-placeholder {
    208     padding: 20px !important;
    209     background-color: #fff !important;
    210 }
    211 
    212 /* Loading Lines */
    213 .loading-line {
    214     height: 10px !important;
    215     background: linear-gradient(120deg, #fdfbfb 0%, #ebedee 100%) !important;
    216     background-size: 200% 100% !important;
    217     margin-bottom: 10px !important;
    218     border-radius: 5px !important;
    219     animation: shimmer 1.5s infinite linear;
    220 }
    221178
    222179/* Mobile Styling */
     
    289246
    290247        .status-table {
    291            
     248
    292249            margin-block-end: 0;
    293250            border-collapse: collapse;
     
    298255                border-bottom: 1px solid #e9e8e8;
    299256            }
     257
    300258            td {
    301259                padding: 10px 0;
    302260                /* Adjust spacing to your preference */
    303261            }
     262
    304263            .right {
    305264                text-align: right;
     
    310269        ul {
    311270            list-style-type: none;
    312            
     271
    313272            margin-block-end: 0;
    314273
     
    319278
    320279        form {
     280
    321281            input[type="number"],
    322282            input[type="text"] {
     
    325285                border-radius: 4px;
    326286            }
    327            
     287
    328288            input[type="number"] {
    329289                padding-block: 0;
     
    352312            transition: 0.3s ease;
    353313            font-size: 15px;
    354            
     314
    355315            &:hover {
    356316                background-color: #0c50c5;
     
    362322    /* Credits section: optional progress bar styling */
    363323    .credits-info {
    364        
     324
    365325
    366326        p {
     
    387347    .credit-buy {
    388348        margin-block-start: 15px;
     349
    389350        strong {
    390351            font-size: 15px;
     
    393354        .credits-buy-links {
    394355            margin-block-start: 6px;
    395            
     356
    396357            a {
    397358                inline-size: 100%;
     
    403364        }
    404365
    405        
    406     }
    407    
     366
     367    }
     368
    408369    .help-links-list {
    409370        li {
    410371            margin-block: 30px;
    411372        }
     373
    412374        a {
    413375            display: flex;
     
    430392                align-items: flex-start;
    431393                gap: 0;
    432                
     394
    433395                p {
    434396                    margin: 0;
     
    438400    }
    439401}
     402
     403.switch {
     404    position: relative;
     405    display: inline-block;
     406    width: 51px;
     407    height: 24px;
     408    margin-right: 6px;
     409
     410    input {
     411        opacity: 0;
     412        width: 0;
     413        height: 0;
     414
     415        &:checked+.slider {
     416            background-color: #2196F3;
     417
     418            &:before {
     419                transform: translateX(27px);
     420            }
     421        }
     422    }
     423
     424    .slider {
     425        position: absolute;
     426        cursor: pointer;
     427        top: 0;
     428        left: 0;
     429        right: 0;
     430        bottom: 0;
     431        background-color: #ccc;
     432        transition: background-color 0.4s;
     433        border-radius: 34px;
     434
     435        &:before {
     436            position: absolute;
     437            content: "";
     438            aspect-ratio: 1 / 1;
     439            height: 18px;
     440            left: 3px;
     441            bottom: 3px;
     442            background-color: white;
     443            transition: transform 0.4s;
     444            border-radius: 50%;
     445        }
     446    }
     447}
     448
    440449
    441450
     
    479488
    480489        text-decoration: none;
     490
    481491        &:hover {
    482492            background-color: #358a38;
     
    494504    font-size: 18px;
    495505}
     506
    496507.general-form-description {
    497508    margin: 0;
     
    499510    font-size: 15px;
    500511}
     512
    501513.general-form-input {
    502514    inline-size: min-content;
     
    515527    }
    516528}
     529
     530.loading-line {
     531    height: 10px !important;
     532    background: linear-gradient(120deg, #fdfbfb 0%, #ebedee 100%) !important;
     533    background-size: 200% 100% !important;
     534    margin-bottom: 10px !important;
     535    border-radius: 5px !important;
     536    animation: shimmer 1.5s infinite linear;
     537}
  • postology/trunk/assets/js/postology-admin.js

    r3268387 r3284680  
    195195
    196196
     197    const widgetVisibility = document.querySelector("#widget-visibility-checkbox");
     198    if (widgetVisibility) {
     199        widgetVisibility.addEventListener('change', function (e) {
     200            // Convert checked state to a numeric value (1 for true, 0 for false)
     201            var visibility = e.target.checked ? 1 : 0;
     202
     203            if (visibility) {
     204                document.querySelector("#widget-visibility-status-span").innerText = "Visible";
     205                document.querySelector("#widget-visibility-status-span").style.color = "#16db16";
     206
     207            }else {
     208                document.querySelector("#widget-visibility-status-span").innerText = "Not Visible";
     209                document.querySelector("#widget-visibility-status-span").style.color = "#ed7858";
     210            }
     211
     212            // Prepare the POST data. Include 'action' parameter so WordPress knows which function to call.
     213            var postData = 'action=update_widget_visibility&visibility=' + encodeURIComponent(visibility);
     214
     215            // Optionally include nonce if you have set one:
     216            postData += '&security=' + encodeURIComponent(myAjax.nonce);
     217
     218            // Use fetch() to send the AJAX POST request
     219            fetch(myAjax.ajaxurl, {
     220                method: 'POST',
     221                headers: {
     222                    'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8'
     223                },
     224                body: postData
     225            })
     226                .then(function (response) {
     227                    return response.text();
     228                })
     229                .then(function (data) {
     230                    console.log('Server response:', data);
     231                })
     232                .catch(function (error) {
     233                    console.error('Error updating widget visibility:', error);
     234                });
     235        });
     236    }
     237    console.log(widgetVisibility)
    197238    console.log('settings loaded');
    198239});
  • postology/trunk/assets/js/postology.js

    r3258438 r3284680  
    1 jQuery(document).ready(function ($) {
    2     // console.log( postologySettings )
    3 
    4     // Initialization on page load
    5     // Show the generate summary button
    6     $('#generate-summary').show();
    7     // Hide the summary content
    8     $('#summary-content').hide();
    9     // Hide the "Powered by Postology" text
    10     $('.postology-powered-by').hide();
    11 
    12     $('#generate-summary').on('click', function () {
    13         if (typeof postologySettings === 'undefined') {
    14             console.error('postologySettings is not defined. Please ensure the plugin settings are correctly configured.');
    15             $('#summary').html('<p>Error: Plugin settings are not configured. Please check the plugin documentation.</p>').show();
    16             return;
    17         }
    18         // Disable the button to prevent multiple clicks
    19         const $thisButton = $(this);
    20         $thisButton.prop('disabled', true);
    21 
    22         const defaultSelectors = postologySettings.selectors || '.article-content';
     1const styles = `
     2/* Postology Styles */
     3
     4/* Main Container */
     5#postology-box {
     6    position: relative;
     7    display: flex;
     8    align-items: center;
     9    justify-content: space-between;
     10    flex-wrap: nowrap;
     11    width: 100%;
     12    box-sizing: border-box;
     13    padding: 9px 12px;
     14    overflow: hidden;
     15    margin-block-end: 30px;
     16    font-family: "Plus Jakarta Sans", serif;
     17
     18    /* Header Text */
     19    .postology-header {
     20        flex-grow: 1;
     21        overflow: hidden;
     22        display: flex;
     23        align-items: center;
     24    }
     25
     26    p {
     27        margin-block: auto;
     28        font-weight: 600;
     29    }
     30
     31    /* Generate Summary Button */
     32    #generate-summary {
     33        display: flex;
     34        align-items: center;
     35        justify-content: center;
     36        cursor: pointer;
     37        padding: 6px 20px;
     38        transition: background-color 0.3s, transform 0.3s, box-shadow 0.3s;
     39        white-space: nowrap;
     40
     41        &:disabled {
     42            /* background-color: #9c9c9c; */
     43            cursor: not-allowed;
     44            transform: translateY(0px);
     45        }
     46        &:hover {
     47            transform: translateY(-2px);
     48        }
     49    }
     50}
     51
     52
     53/* Icon */
     54.icon {
     55    margin-right: 8px;
     56    width: 30px;
     57}
     58
     59
     60
     61/* Summary Content */
     62
     63.nav-tab-disabled {
     64    color: #a0a5aa;
     65    cursor: not-allowed;
     66    text-decoration: none;
     67
     68    &:hover {
     69        color: #a0a5aa;
     70    }
     71}
     72
     73/* Summary Container */
     74#summary-content {
     75    display: none;
     76    width: 100%;
     77    box-sizing: border-box;
     78    padding: 16px 16px 12px 16px;
     79    font-family: "Plus Jakarta Sans", serif;
     80    margin-block-end: 30px;
     81
     82    /* Summary Title */
     83    #summary-title {
     84        display: flex;
     85        align-items: center;
     86        gap: 8px;
     87        margin-bottom: 15px;
     88
     89        p {
     90            margin: 0;
     91        }
     92    }
     93
     94    #summary-content-placeholder {
     95        background-color: #a3a3a3;
     96        border-radius: 9px;
     97        padding: 18px;
     98
     99        ul {
     100            list-style-type: disc;
     101            padding-left: 20px;
     102            margin: 0;
     103           
     104            li {
     105                margin-bottom: 12px;
     106            }
     107        }
     108    }
     109
     110    /* "Powered by Postology" Text */
     111    .postology-powered-by {
     112        font-size: 12px;
     113        color: #888888;
     114        text-align: right;
     115        margin-top: 12px;
     116    }
     117}
     118
     119/* Loading Placeholder */
     120#loading-placeholder {
     121    display: none;
     122    padding: 20px;
     123    background-color: #fff;
     124}
     125
     126/* Loading Lines */
     127.loading-line {
     128    height: 10px;
     129    background: linear-gradient(120deg, #fdfbfb 0%, #ebedee 100%);
     130    background-size: 200% 100%;
     131    margin-bottom: 10px;
     132    border-radius: 6px;
     133    animation: shimmer 1.5s infinite linear;
     134}
     135
     136/* Mobile Styling */
     137@media (max-width: 768px) {
     138    #postology-box {
     139        flex-direction: column;
     140        align-items: flex-start;
     141    }
     142
     143    .postology-header {
     144        margin-bottom: 10px;
     145    }
     146
     147    #generate-summary {
     148        width: 100%;
     149        margin-bottom: 10px;
     150    }
     151}
     152
     153/* Animation Keyframes */
     154@keyframes shimmer {
     155    0% {
     156        background-position: -200% 0;
     157    }
     158    100% {
     159        background-position: 200% 0;
     160    }
     161}
     162
     163`;
     164/*  assets/js/postology-box.js  */
     165class PostologyBox extends HTMLElement {
     166
     167    /* ——————————————————————————————————— */
     168    /*  1.  Life‑cycle hook                  */
     169    /* ——————————————————————————————————— */
     170    connectedCallback() {
     171        /* Guard against double init */
     172        if (this.shadowRoot) return;
     173
     174        /* Create shadow DOM and move markup inside it */
     175        const shadow = this.attachShadow({ mode: 'open' });
     176        const style = document.createElement('style');
     177        style.textContent = styles;
     178        shadow.append(style);
     179
     180        const tpl = document.createElement('template');
     181        tpl.innerHTML = this.innerHTML;          // everything PHP printed
     182        shadow.appendChild(tpl.content.cloneNode(true));
     183        this.innerHTML = '';                      // empty light‑DOM
     184
     185        /* Cache frequently‑used nodes */
     186        this.$btn = shadow.querySelector('#generate-summary');
     187        this.$summary = shadow.querySelector('#summary-content');
     188        this.$loading = shadow.querySelector('#loading-placeholder');
     189        this.$title = shadow.querySelector('#summary-title');
     190        this.$placeholder = shadow.querySelector('#summary-content-placeholder');
     191        this.$poweredBy = shadow.querySelector('.postology-powered-by');
     192        this.$boxWrapper = shadow.querySelector('#postology-box');
     193
     194        /* Initial “ready” state (mirrors the old $(document).ready) */
     195        if (this.$btn) this.$btn.style.display = '';      // show
     196        if (this.$summary) this.$summary.style.display = 'none';  // hide
     197        if (this.$poweredBy) this.$poweredBy.style.display = 'none'; // hide
     198
     199        /* Hook up click */
     200        this.$btn?.addEventListener('click', () => this.requestSummary());
     201    }
     202
     203    /* ——————————————————————————————————— */
     204    /*  2.  Helper: collect article text     */
     205    /* ——————————————————————————————————— */
     206    getArticleContent() {
     207        if (typeof postologySettings === 'undefined') return null;
     208
     209        const defaults = postologySettings.selectors || '.article-content';
    23210        const findElements = postologySettings.find_elements || 'p, h2, h3, h4, h5, h6';
    24211        const excludedClasses = postologySettings.excluded_classes || '.related-posts, .ads-section, .banner, .comments';
    25         const excludedSelector = excludedClasses.split(',').map(cls => cls.trim()).join(',');
    26 
    27         // Exclude elements with specific classes
    28         const articleContent = $(defaultSelectors)
    29             .find(findElements)
    30             .not(excludedSelector)
    31             .text()
    32             .trim();
    33 
    34 
    35         if (!articleContent) {
    36             console.error('No content found. Please check your article structure.');
    37             $('#summary').html('<p>Error: No content found. Please ensure your article has the correct structure or adjust the content selectors in the plugin settings.</p>').show();
     212
     213        /* Build a fast lookup Set of nodes that should be excluded */
     214        const excludedSel = excludedClasses.split(',')
     215            .map(cls => cls.trim())
     216            .filter(Boolean)
     217            .join(',');
     218        const isExcluded = excludedSel
     219            ? (el) => el.closest(excludedSel)
     220            : () => false;
     221
     222        let text = '';
     223        document.querySelectorAll(defaults).forEach(root => {
     224            root.querySelectorAll(findElements).forEach(node => {
     225                if (!isExcluded(node)) text += ' ' + node.textContent;
     226            });
     227        });
     228        return text.trim();
     229    }
     230
     231    /* ——————————————————————————————————— */
     232    /*  3.  Main click‑handler               */
     233    /* ——————————————————————————————————— */
     234    async requestSummary() {
     235
     236        /* Safety checks -------------------------------------------------- */
     237        if (typeof postologySettings === 'undefined') {
     238            console.error('postologySettings is not defined. Check plugin config.');
     239            this.$placeholder.innerHTML = `<p>Error: Plugin settings are not configured.</p>`;
    38240            return;
    39241        }
    40242
    41         const $summaryContent = $('#summary-content');
    42         const $loadingPlaceholder = $('#loading-placeholder');
    43         const $postologyBox = $('#postology-box');
    44 
    45         $summaryContent.show();
    46         $loadingPlaceholder.show();
    47 
    48         // === Analytics Feature: Increment Clicks ===
    49         $.ajax({
    50             url: postologySettings.ajax_url,
    51             method: 'POST',
    52             data: {
    53                 action: 'postology_increment_clicks',
     243        const content = this.getArticleContent();
     244        if (!content) {
     245            console.error('No content found. Check your selectors in plugin settings.');
     246            this.$placeholder.innerHTML = `<p>Error: No content found in article.</p>`;
     247            return;
     248        }
     249
     250        /* UI state ------------------------------------------------------- */
     251        this.$btn.disabled = true;
     252        this.$summary.style.display = 'block';         // show
     253        this.$loading.style.display = 'block';         // show
     254        // this.$placeholder.innerHTML = '';         // clear
     255
     256        /* Helper for POST x‑www‑form‑urlencoded -------------------------- */
     257        const post = (data) => fetch(
     258            postologySettings.ajax_url,
     259            {
     260                method: 'POST',
     261                headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
     262                body: new URLSearchParams(data)
     263            }
     264        ).then(r => r.json());
     265
     266        /* 1) Analytics: increment clicks -------------------------------- */
     267        post({
     268            action: 'postology_increment_clicks',
     269            nonce: postologySettings.nonce,
     270            url_path: window.location.href
     271        }).catch(err => {
     272            console.error('Failed to increment clicks:', err);
     273        });
     274
     275        try {
     276            /* 2) Generate the summary ---------------------------------- */
     277            const res = await post({
     278                action: 'generate_summary',
    54279                nonce: postologySettings.nonce,
    55                 url_path: window.location.href     // Capture the current page URL
     280                content
     281            });
     282
     283            this.$loading.style.display = 'none';
     284
     285            if (res && res.success) {
     286                /* Success path */
     287                this.$placeholder.innerHTML = res.data;    // render summary
     288                if (this.$poweredBy) this.$poweredBy.style.display = 'block'; // unhide
     289                this.$boxWrapper?.remove();                      // remove button panel
     290            } else {
     291                /* WP returns success:false */
     292                console.error('Server error:', res?.data);
     293                this.$placeholder.innerHTML = `<p>Something went wrong. Please try again later.</p>`;
     294                this.$btn.disabled = false;
    56295            }
    57         })
    58         .done(function (response) {
    59             if (!response.success) {
    60                 console.error('Failed to increment clicks: ' + response.data);
    61             }
    62         })
    63         .fail(function (jqXHR, textStatus, errorThrown) {
    64             console.error('AJAX request for incrementing clicks failed: ' + textStatus + ', ' + errorThrown);
    65         });
    66 
    67         // === Generate Summary AJAX Request ===
    68         $.ajax({
    69             url: postologySettings.ajax_url,
    70             method: 'POST',
    71             data: {
    72                 action: 'generate_summary',
    73                 content: articleContent,
    74                 nonce: postologySettings.nonce,
    75             }
    76         })
    77         .done(function (response) {
    78             $loadingPlaceholder.hide();
    79             if (response.success) {
    80                 $('#summary-title').show(); // Ensure the title remains visible
    81                 $('#summary-content-placeholder').html(response.data);
    82                 // Show "Powered by Postology"
    83                 $('.postology-powered-by').show();
    84                 // Hide the generate summary button to prevent multiple clicks
    85                 // $thisButton.hide(); // no need if we simply disable and re-enable it
    86                 $('#postology-box').remove();
    87             } else {
    88                 console.error('Error from server: ' + response.data);
    89                 $('#summary-content-placeholder').html(`<p>Something went wrong, Please try again later or contact support.</p>`).show();
    90             }
    91         })
    92         .fail(function (jqXHR, textStatus, errorThrown) {
    93             $loadingPlaceholder.hide();
    94             let errorMessage = 'An error occurred while processing the request.';
    95             if (textStatus === 'timeout') {
    96                 errorMessage = 'The request timed out. Please try again later or contact support.';
    97             }
    98             console.error('AJAX request failed: ' + textStatus + ', ' + errorThrown);
    99             $('#summary-content-placeholder').html(`<p>${errorMessage} Please check your internet connection or try again later.</p>`).show();
    100             $thisButton.prop('disabled', false);
    101         })
    102         // .always(function () {
    103         //     // Re-enable the button after the request is complete
    104         //     // $thisButton.prop('disabled', false);
    105         // });
    106     });
    107 });
     296
     297        } catch (err) {
     298            /* Network / fetch error */
     299            console.error('AJAX request failed:', err);
     300            this.$loading.style.display = 'none';
     301            this.$placeholder.innerHTML = `<p>An error occurred while contacting the server. Please try again.</p>`;
     302            this.$btn.disabled = false;
     303        }
     304    }
     305}
     306
     307/* Register the component once */
     308customElements.define('postology-el', PostologyBox);
  • postology/trunk/includes/components/customization.php

    r3273291 r3284680  
    3333            $styles['background-color'] = get_option('postology_button_background_color', '#FFFFFF');
    3434            $styles['border'] = '1px solid ' . get_option('postology_button_border_color', '#E2E8F0');
    35             $styles['border-radius'] = get_option('postology_button_border_radius', '12px');
     35            $styles['border-radius'] = get_option('postology_button_border_radius', '9px');
    3636            break;
    3737        case 'bullet_points_text':
     
    3939            $styles['font-family'] = get_option('postology_bullet_points_font_family', 'inherit');
    4040            $styles['font-weight'] = get_option('postology_bullet_points_font_weight', 'normal');
    41             $styles['color'] = get_option('postology_bullet_points_font_color', '#ff0000');
     41            $styles['color'] = get_option('postology_bullet_points_font_color', '#000000');
    4242            $styles['line-height'] = get_option('postology_bullet_points_line_height', '1.5');
    4343            break;
    4444        case 'main_container':
    4545            $styles['background-color'] = get_option('postology_main_container_background_color', '#FFFFFF');
    46             $styles['border-radius'] = get_option('postology_main_container_border_radius', '12px');
     46            $styles['border-radius'] = get_option('postology_main_container_border_radius', '9px');
    4747            $styles['border'] = '0px solid ' . get_option('postology_main_container_border_color', '#000000');
    4848            $styles['box-shadow'] = get_option('postology_main_container_border_shadow', '3px 12px 15px 3px rgba(0, 0, 0, 0.1)');
     
    5050        case 'inner_container':
    5151            $styles['background-color'] = get_option('postology_inner_container_background_color', '#FFFFFF');
    52             $styles['border-radius'] = get_option('postology_inner_container_border_radius', '12px');
     52            $styles['border-radius'] = get_option('postology_inner_container_border_radius', '9px');
    5353            $styles['border'] = '0px solid ' . get_option('postology_inner_container_border_color', '#000000');
    5454            $styles['box-shadow'] = get_option('postology_inner_container_border_shadow', '3px 12px 15px 3px rgba(0, 0, 0, 0.1)');
     
    229229            </div>
    230230   
    231             <div class="custom-card" style="grid-column-start:1;padding-top:18px;">
     231            <div class="custom-card" style="grid-column-start:1;padding-top:18px;background:transparent;">
    232232                <?php echo add_box(); // Replace with your own function if needed ?>
    233233            </div>
     
    306306                    <section style="display:flex;flex-direction:column;gap:9px;padding: 9px 15px;">
    307307                        <strong><?php esc_html_e( 'Font Size', 'postology-pro' ); ?></strong>
    308                         <input type="text" name="postology_header_font_size" value="<?php echo esc_attr( get_option( 'postology_header_font_size', '16px' ) ); ?>" size="10" />
     308                        <input type="text" name="postology_header_font_size" value="<?php echo esc_attr( get_option( 'postology_header_font_size', '14px' ) ); ?>" size="10" />
    309309                    </section>
    310310                    <section style="display:flex;flex-direction:column;gap:9px;padding: 9px 15px;">
     
    331331                    <section style="display:flex;flex-direction:column;gap:9px;padding: 9px 15px;">
    332332                        <strong><?php esc_html_e( 'Font Size', 'postology-pro' ); ?></strong>
    333                         <input type="text" name="postology_summary_heading_font_size" value="<?php echo esc_attr( get_option( 'postology_summary_heading_font_size', '18px' ) ); ?>" size="10" />
     333                        <input type="text" name="postology_summary_heading_font_size" value="<?php echo esc_attr( get_option( 'postology_summary_heading_font_size', '16px' ) ); ?>" size="10" />
    334334                    </section>
    335335                    <section style="display:flex;flex-direction:column;gap:9px;padding: 9px 15px;">
     
    360360                    <section style="display:flex;flex-direction:column;gap:9px;padding: 9px 15px;">
    361361                        <strong><?php esc_html_e( 'Font Size', 'postology-pro' ); ?></strong>
    362                         <input type="text" name="postology_button_font_size" value="<?php echo esc_attr( get_option( 'postology_button_font_size', '16px' ) ); ?>" size="10" />
     362                        <input type="text" name="postology_button_font_size" value="<?php echo esc_attr( get_option( 'postology_button_font_size', '14px' ) ); ?>" size="10" />
    363363                    </section>
    364364                    <section style="display:flex;flex-direction:column; gap:9px;padding: 9px 15px;">
     
    368368                    <section style="display:flex;flex-direction:column; gap:9px;padding: 9px 15px;">
    369369                        <strong><?php esc_html_e( 'Font Weight', 'postology-pro' ); ?></strong>
    370                         <input type="text" name="postology_button_font_weight" value="<?php echo esc_attr( get_option( 'postology_button_font_weight', 'bold' ) ); ?>" size="10" />
     370                        <input type="text" name="postology_button_font_weight" value="<?php echo esc_attr( get_option( 'postology_button_font_weight', '600' ) ); ?>" size="10" />
    371371                    </section>
    372372                    <section style="display:flex;flex-direction:column; gap:9px;padding: 9px 15px;">
     
    414414                    <section style="display:flex;flex-direction:column; gap:9px;padding: 9px 15px;">
    415415                        <strong><?php esc_html_e( 'Border Radius', 'postology-pro' ); ?></strong>
    416                         <input type="text" name="postology_main_container_border_radius" value="<?php echo esc_attr( get_option( 'postology_main_container_border_radius', '16px' ) ); ?>" size="10" />
     416                        <input type="text" name="postology_main_container_border_radius" value="<?php echo esc_attr( get_option( 'postology_main_container_border_radius', '9px' ) ); ?>" size="10" />
    417417                    </section>
    418418                    <section style="display:flex;flex-direction:column; gap:9px;padding: 9px 15px;">
     
    422422                    <section style="display:flex;flex-direction:column; gap:9px;padding: 9px 15px;">
    423423                        <strong><?php esc_html_e( 'Border Shadow', 'postology-pro' ); ?></strong>
    424                         <input type="text" name="postology_main_container_border_shadow" value="<?php echo esc_attr( get_option( 'postology_main_container_border_shadow', '0 0 10px rgba(0, 0, 0, 0.2)' ) ); ?>" size="30" />
     424                        <input type="text" name="postology_main_container_border_shadow" value="<?php echo esc_attr( get_option( 'postology_main_container_border_shadow', '3px 12px 15px 3px rgba(0, 0, 0, 0.1)' ) ); ?>" size="30" />
    425425                    </section>
    426426                </div>
     
    443443                    <section style="display:flex;flex-direction:column; gap:9px;border:solid 1px lightgrey;padding: 9px 15px;border-radius: 9px;">
    444444                        <strong><?php esc_html_e( 'Border Shadow', 'postology-pro' ); ?></strong>
    445                         <input type="text" name="postology_inner_container_border_shadow" value="<?php echo esc_attr( get_option( 'postology_inner_container_border_shadow', 'none' ) ); ?>" size="20" />
     445                        <input type="text" name="postology_inner_container_border_shadow" value="<?php echo esc_attr( get_option( 'postology_inner_container_border_shadow', '3px 12px 15px 3px rgba(0, 0, 0, 0.1)' ) ); ?>" size="20" />
    446446                    </section>
    447447                </div>
     
    456456                    <section style="display:flex;flex-direction:column; gap:9px;padding: 9px 15px;">
    457457                        <strong><?php esc_html_e( 'Border Radius', 'postology-pro' ); ?></strong>
    458                         <input type="text" name="postology_button_border_radius" value="<?php echo esc_attr( get_option( 'postology_button_border_radius', '8px' ) ); ?>" size="10" />
     458                        <input type="text" name="postology_button_border_radius" value="<?php echo esc_attr( get_option( 'postology_button_border_radius', '9px' ) ); ?>" size="10" />
    459459                    </section>
    460460                    <section style="display:flex;flex-direction:column; gap:9px;padding: 9px 15px;">
    461461                        <strong><?php esc_html_e( 'Border Color', 'postology-pro' ); ?></strong>
    462                         <input type="text" name="postology_button_border_color" value="<?php echo esc_attr( get_option( 'postology_button_border_color', '#000000' ) ); ?>" class="color-field" />
     462                        <input type="text" name="postology_button_border_color" value="<?php echo esc_attr( get_option( 'postology_button_border_color', '#E2E8F0' ) ); ?>" class="color-field" />
    463463                    </section>
    464464                </div>
     
    473473                </div>
    474474            </div>
    475             <div class="custom-card" style="grid-column-start:1; grid-column-end: 3; padding-top:18px;">
     475            <div class="custom-card" style="grid-column-start:1; grid-column-end: 3; padding-top:18px;background:transparent;">
    476476                <?php echo add_box(); // Replace with your custom function ?>
    477477            </div>
  • postology/trunk/includes/components/dashboard.php

    r3269342 r3284680  
    77if ( ! function_exists( 'render_dashboard_component' ) ) {
    88    function render_dashboard_component() {
     9        $widget_visibility    = get_option( 'postology_widget_visibility', true );
    910        $heading_text_option = get_option( 'postology_heading_text', esc_html__( 'Get an AI-generated summary of this article.', 'postology' ) );
    1011        $button_text_option  = get_option( 'postology_button_text', esc_html__( 'Generate Summary', 'postology' ) );
     
    3334                        <tr>
    3435                            <td><strong>Widget Visibility:</strong></td>
    35                             <td class="right" style="color: #16db16;">Visible</td>
     36                            <td class="right" style='display:flex;align-items:center;justify-content:flex-end;gap:9px;'>
     37                                <span id="widget-visibility-status-span" style="margin-top:1px;color: <?php echo $widget_visibility ? '#16db16' : '#ed7858'; ?>">
     38                                    <?php if ($widget_visibility == 1) {echo "Visible";} else { echo "Not Visible"; } ?>
     39                                </span>
     40                                <label class="switch" >
     41                                    <input type="checkbox" id="widget-visibility-checkbox" <?php if ($widget_visibility == 1) {echo "checked";} ?>>
     42                                    <span class="slider"></span>
     43                                </label>
     44                            </td>
    3645                        </tr>
    3746                        <tr>
     
    128137                        </a>
    129138                        <button type="submit" style="margin:0;">Save Changes</button>
     139                        <input type="hidden" name="postology_widget_visibility" value=<?php if ($widget_visibility == 1) {echo 1;} ?>>
    130140                    </section>
    131141                </form>
  • postology/trunk/includes/components/general.php

    r3269342 r3284680  
    1616        $powered       = get_option( 'postology_display_powered_by', 'no' );
    1717       
    18         error_log($powered);
    1918        // styles
    2019        $general_form_section = "display: grid; grid-template-columns: 30% 1fr; font-size: 18px;";
  • postology/trunk/postology-plugin.php

    r3268387 r3284680  
    2424     */
    2525    public function __construct() {
     26        // Activation hook to create analytics database table
     27        register_activation_hook(__FILE__, array('Postology', 'on_activation'));
     28
    2629        // Enqueue scripts and styles
    2730        add_action('wp_enqueue_scripts', array($this, 'enqueue_scripts'));
     
    3336        add_action('wp_ajax_generate_summary', array($this, 'ajax_handler'));
    3437        add_action('wp_ajax_nopriv_generate_summary', array($this, 'ajax_handler'));
    35 
    36         register_activation_hook(__FILE__, array('Postology', 'on_activation'));
    3738    }
    3839    /**
     
    6364     */
    6465    public function enqueue_scripts() {
     66        $widget_visibility = get_option('postology_widget_visibility', true);
     67        if (!$widget_visibility) {
     68            return; // Do not enqueue the scripts if the widget is not visible.
     69        }
     70       
    6571        wp_enqueue_style('postology-style', plugin_dir_url(__FILE__) . '/assets/css/postology-style.css', array(), '1.0.0');
    6672        wp_enqueue_script('postology-script', plugin_dir_url(__FILE__) . '/assets/js/postology.js', array('jquery'), '1.0.0', true);
     
    8187     */
    8288    public function add_box($content) {
     89        // Retrieve the setting value; if false then widget should not display.
     90        $widget_visibility = get_option('postology_widget_visibility', true);
     91
     92        // If the user has disabled the widget, return the original content.
     93        if (!$widget_visibility) {
     94            return $content;
     95        }
     96
    8397        if (is_single()) {
    8498            $excluded_patterns = get_option('postology_excluded_urls', '');
     
    99113            ob_start();
    100114            ?>
    101             <div id="postology-box" style="<?php echo esc_attr($this->get_style('main_container')); ?>">
    102                 <div class="postology-header" style="<?php echo esc_attr($this->get_style('header_text')); ?>">
    103                     <svg width="29" height="31" viewBox="0 0 29 31" fill="none" xmlns="http://www.w3.org/2000/svg"
    104                      class="postology-box-icon">
    105                         <g filter="url(#filter0_dd_5_106)">
    106                         <path class="fill-path" d="M20.5398 10.7576C20.4742 10.7576 20.4185 10.7445 20.3725 10.7183C20.3266 10.6921 20.2905 10.6462 20.2643 10.5807L19.6936 9.24382L18.2569 8.61472C18.1913 8.5885 18.1454 8.55246 18.1192 8.50659C18.0929 8.46072 18.0798 8.40502 18.0798 8.33948C18.0798 8.27395 18.0929 8.21825 18.1192 8.17238C18.1454 8.12651 18.1913 8.09046 18.2569 8.06425L19.6936 7.45481L20.2643 6.17694C20.2905 6.1114 20.3266 6.06553 20.3725 6.03932C20.4185 6.01311 20.4742 6 20.5398 6C20.6054 6 20.6612 6.01311 20.7071 6.03932C20.753 6.06553 20.7891 6.1114 20.8153 6.17694L21.386 7.45481L22.8227 8.06425C22.8883 8.09046 22.9342 8.12651 22.9604 8.17238C22.9867 8.21825 22.9998 8.27395 22.9998 8.33948C22.9998 8.40502 22.9867 8.46072 22.9604 8.50659C22.9342 8.55246 22.8883 8.5885 22.8227 8.61472L21.386 9.24382L20.8153 10.5807C20.7891 10.6462 20.753 10.6921 20.7071 10.7183C20.6612 10.7445 20.6054 10.7576 20.5398 10.7576ZM20.5398 22.4747C20.4873 22.4747 20.4349 22.4616 20.3824 22.4354C20.3299 22.4092 20.2905 22.3633 20.2643 22.2977L19.6936 21.0199L18.2766 20.4104C18.211 20.3842 18.1651 20.3482 18.1389 20.3023C18.1126 20.2564 18.0995 20.2007 18.0995 20.1352C18.0995 20.0697 18.1126 20.014 18.1389 19.9681C18.1651 19.9222 18.211 19.8862 18.2766 19.86L19.6936 19.2505L20.2643 17.894C20.2905 17.8285 20.3266 17.7826 20.3725 17.7564C20.4185 17.7302 20.4742 17.7171 20.5398 17.7171C20.6054 17.7171 20.6612 17.7302 20.7071 17.7564C20.753 17.7826 20.7891 17.8285 20.8153 17.894L21.386 19.2505L22.803 19.86C22.8686 19.8862 22.9145 19.9222 22.9408 19.9681C22.967 20.014 22.9801 20.0697 22.9801 20.1352C22.9801 20.2007 22.967 20.2564 22.9408 20.3023C22.9145 20.3482 22.8686 20.3842 22.803 20.4104L21.386 21.0199L20.8153 22.2977C20.7891 22.3633 20.7497 22.4092 20.6973 22.4354C20.6448 22.4616 20.5923 22.4747 20.5398 22.4747ZM11.9003 19.0736C11.7953 19.0736 11.6937 19.0441 11.5953 18.9851C11.4969 18.9261 11.4214 18.8442 11.369 18.7394L10.0898 16.0067L7.33456 14.7681C7.2296 14.7157 7.1476 14.6404 7.08856 14.5421C7.02952 14.4438 7 14.3422 7 14.2373C7 14.1325 7.02952 14.0309 7.08856 13.9326C7.1476 13.8343 7.2296 13.759 7.33456 13.7065L10.0898 12.468L11.369 9.75497C11.4214 9.63701 11.4969 9.54854 11.5953 9.48957C11.6937 9.43059 11.7953 9.4011 11.9003 9.4011C12.0053 9.4011 12.1069 9.43059 12.2053 9.48957C12.3037 9.54854 12.3792 9.63046 12.4317 9.73531L13.7305 12.468L16.4661 13.7065C16.5841 13.759 16.6727 13.8343 16.7317 13.9326C16.7908 14.0309 16.8203 14.1325 16.8203 14.2373C16.8203 14.3422 16.7908 14.4438 16.7317 14.5421C16.6727 14.6404 16.5841 14.7157 16.4661 14.7681L13.7305 16.0067L12.4317 18.7394C12.3792 18.8573 12.3037 18.9425 12.2053 18.9949C12.1069 19.0474 12.0053 19.0736 11.9003 19.0736Z"
    107                         style="<?php echo esc_attr($this->get_style('icon_container')); ?>" />
    108                         </g>
    109                         <defs>
    110                         <filter id="filter0_dd_5_106" x="0.633232" y="0.438226" width="28.0017" height="29.5741" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">
    111                         <feFlood flood-opacity="0" result="BackgroundImageFix"/>
    112                         <feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/>
    113                         <feOffset dx="-1.31726" dy="2.48816"/>
    114                         <feGaussianBlur stdDeviation="2.52475"/>
    115                         <feComposite in2="hardAlpha" operator="out"/>
    116                         <feColorMatrix type="matrix" values="0 0 0 0 0.0506089 0 0 0 0 0.0159861 0 0 0 0 0.191833 0 0 0 0.25 0"/>
    117                         <feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow_5_106"/>
    118                         <feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/>
    119                         <feOffset dx="1.24408" dy="-1.1709"/>
    120                         <feGaussianBlur stdDeviation="2.19544"/>
    121                         <feComposite in2="hardAlpha" operator="out"/>
    122                         <feColorMatrix type="matrix" values="0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0.35 0"/>
    123                         <feBlend mode="normal" in2="effect1_dropShadow_5_106" result="effect2_dropShadow_5_106"/>
    124                         <feBlend mode="normal" in="SourceGraphic" in2="effect2_dropShadow_5_106" result="shape"/>
    125                         </filter>
    126                         </defs>
    127                     </svg>
    128                     <?php echo esc_html($heading_text); ?>
     115            <postology-el
     116                data-heading-text="<?php echo esc_attr( $heading_text ); ?>"
     117                data-button-text="<?php echo esc_attr( $button_text ); ?>"
     118                data-powered-by="<?php echo esc_attr( $powered_by_option ); ?>"
     119            >
     120                <div id="postology-box" style="<?php echo esc_attr($this->get_style('main_container')); ?>">
     121                    <div class="postology-header" style="<?php echo esc_attr($this->get_style('header_text')); ?>">
     122                        <svg width="29" height="31" viewBox="0 0 29 31" fill="none" xmlns="http://www.w3.org/2000/svg"
     123                        class="postology-box-icon">
     124                            <g filter="url(#filter0_dd_5_106)">
     125                            <path class="fill-path" d="M20.5398 10.7576C20.4742 10.7576 20.4185 10.7445 20.3725 10.7183C20.3266 10.6921 20.2905 10.6462 20.2643 10.5807L19.6936 9.24382L18.2569 8.61472C18.1913 8.5885 18.1454 8.55246 18.1192 8.50659C18.0929 8.46072 18.0798 8.40502 18.0798 8.33948C18.0798 8.27395 18.0929 8.21825 18.1192 8.17238C18.1454 8.12651 18.1913 8.09046 18.2569 8.06425L19.6936 7.45481L20.2643 6.17694C20.2905 6.1114 20.3266 6.06553 20.3725 6.03932C20.4185 6.01311 20.4742 6 20.5398 6C20.6054 6 20.6612 6.01311 20.7071 6.03932C20.753 6.06553 20.7891 6.1114 20.8153 6.17694L21.386 7.45481L22.8227 8.06425C22.8883 8.09046 22.9342 8.12651 22.9604 8.17238C22.9867 8.21825 22.9998 8.27395 22.9998 8.33948C22.9998 8.40502 22.9867 8.46072 22.9604 8.50659C22.9342 8.55246 22.8883 8.5885 22.8227 8.61472L21.386 9.24382L20.8153 10.5807C20.7891 10.6462 20.753 10.6921 20.7071 10.7183C20.6612 10.7445 20.6054 10.7576 20.5398 10.7576ZM20.5398 22.4747C20.4873 22.4747 20.4349 22.4616 20.3824 22.4354C20.3299 22.4092 20.2905 22.3633 20.2643 22.2977L19.6936 21.0199L18.2766 20.4104C18.211 20.3842 18.1651 20.3482 18.1389 20.3023C18.1126 20.2564 18.0995 20.2007 18.0995 20.1352C18.0995 20.0697 18.1126 20.014 18.1389 19.9681C18.1651 19.9222 18.211 19.8862 18.2766 19.86L19.6936 19.2505L20.2643 17.894C20.2905 17.8285 20.3266 17.7826 20.3725 17.7564C20.4185 17.7302 20.4742 17.7171 20.5398 17.7171C20.6054 17.7171 20.6612 17.7302 20.7071 17.7564C20.753 17.7826 20.7891 17.8285 20.8153 17.894L21.386 19.2505L22.803 19.86C22.8686 19.8862 22.9145 19.9222 22.9408 19.9681C22.967 20.014 22.9801 20.0697 22.9801 20.1352C22.9801 20.2007 22.967 20.2564 22.9408 20.3023C22.9145 20.3482 22.8686 20.3842 22.803 20.4104L21.386 21.0199L20.8153 22.2977C20.7891 22.3633 20.7497 22.4092 20.6973 22.4354C20.6448 22.4616 20.5923 22.4747 20.5398 22.4747ZM11.9003 19.0736C11.7953 19.0736 11.6937 19.0441 11.5953 18.9851C11.4969 18.9261 11.4214 18.8442 11.369 18.7394L10.0898 16.0067L7.33456 14.7681C7.2296 14.7157 7.1476 14.6404 7.08856 14.5421C7.02952 14.4438 7 14.3422 7 14.2373C7 14.1325 7.02952 14.0309 7.08856 13.9326C7.1476 13.8343 7.2296 13.759 7.33456 13.7065L10.0898 12.468L11.369 9.75497C11.4214 9.63701 11.4969 9.54854 11.5953 9.48957C11.6937 9.43059 11.7953 9.4011 11.9003 9.4011C12.0053 9.4011 12.1069 9.43059 12.2053 9.48957C12.3037 9.54854 12.3792 9.63046 12.4317 9.73531L13.7305 12.468L16.4661 13.7065C16.5841 13.759 16.6727 13.8343 16.7317 13.9326C16.7908 14.0309 16.8203 14.1325 16.8203 14.2373C16.8203 14.3422 16.7908 14.4438 16.7317 14.5421C16.6727 14.6404 16.5841 14.7157 16.4661 14.7681L13.7305 16.0067L12.4317 18.7394C12.3792 18.8573 12.3037 18.9425 12.2053 18.9949C12.1069 19.0474 12.0053 19.0736 11.9003 19.0736Z"
     126                            style="<?php echo esc_attr($this->get_style('icon_container')); ?>" />
     127                            </g>
     128                            <defs>
     129                            <filter id="filter0_dd_5_106" x="0.633232" y="0.438226" width="28.0017" height="29.5741" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">
     130                            <feFlood flood-opacity="0" result="BackgroundImageFix"/>
     131                            <feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/>
     132                            <feOffset dx="-1.31726" dy="2.48816"/>
     133                            <feGaussianBlur stdDeviation="2.52475"/>
     134                            <feComposite in2="hardAlpha" operator="out"/>
     135                            <feColorMatrix type="matrix" values="0 0 0 0 0.0506089 0 0 0 0 0.0159861 0 0 0 0 0.191833 0 0 0 0.25 0"/>
     136                            <feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow_5_106"/>
     137                            <feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/>
     138                            <feOffset dx="1.24408" dy="-1.1709"/>
     139                            <feGaussianBlur stdDeviation="2.19544"/>
     140                            <feComposite in2="hardAlpha" operator="out"/>
     141                            <feColorMatrix type="matrix" values="0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0.35 0"/>
     142                            <feBlend mode="normal" in2="effect1_dropShadow_5_106" result="effect2_dropShadow_5_106"/>
     143                            <feBlend mode="normal" in="SourceGraphic" in2="effect2_dropShadow_5_106" result="shape"/>
     144                            </filter>
     145                            </defs>
     146                        </svg>
     147                        <?php echo esc_html($heading_text); ?>
     148                    </div>
     149                    <button id="generate-summary" aria-label="<?php echo esc_html($button_text); ?>" style="<?php echo esc_attr($this->get_style('button_text')); ?>">
     150                        <?php echo esc_html($button_text); ?>
     151                    </button>
    129152                </div>
    130                 <button id="generate-summary" aria-label="<?php echo esc_html($button_text); ?>" style="<?php echo esc_attr($this->get_style('button_text')); ?>">
    131                     <?php echo esc_html($button_text); ?>
    132                 </button>
    133             </div>
    134             <!-- Move the summary-content outside of postology-box -->
    135             <div id="summary-content" style="<?php echo esc_attr($this->get_style('inner_container')); ?>">
    136                 <section id="summary-title" style="<?php echo esc_attr($this->get_style('summary_heading_text')); ?>">
    137                     <svg width="29" height="31" viewBox="0 0 29 31" fill="none" xmlns="http://www.w3.org/2000/svg"
    138                      class="postology-box-icon">
    139                         <g filter="url(#filter0_dd_5_106)">
    140                         <path class="fill-path" d="M20.5398 10.7576C20.4742 10.7576 20.4185 10.7445 20.3725 10.7183C20.3266 10.6921 20.2905 10.6462 20.2643 10.5807L19.6936 9.24382L18.2569 8.61472C18.1913 8.5885 18.1454 8.55246 18.1192 8.50659C18.0929 8.46072 18.0798 8.40502 18.0798 8.33948C18.0798 8.27395 18.0929 8.21825 18.1192 8.17238C18.1454 8.12651 18.1913 8.09046 18.2569 8.06425L19.6936 7.45481L20.2643 6.17694C20.2905 6.1114 20.3266 6.06553 20.3725 6.03932C20.4185 6.01311 20.4742 6 20.5398 6C20.6054 6 20.6612 6.01311 20.7071 6.03932C20.753 6.06553 20.7891 6.1114 20.8153 6.17694L21.386 7.45481L22.8227 8.06425C22.8883 8.09046 22.9342 8.12651 22.9604 8.17238C22.9867 8.21825 22.9998 8.27395 22.9998 8.33948C22.9998 8.40502 22.9867 8.46072 22.9604 8.50659C22.9342 8.55246 22.8883 8.5885 22.8227 8.61472L21.386 9.24382L20.8153 10.5807C20.7891 10.6462 20.753 10.6921 20.7071 10.7183C20.6612 10.7445 20.6054 10.7576 20.5398 10.7576ZM20.5398 22.4747C20.4873 22.4747 20.4349 22.4616 20.3824 22.4354C20.3299 22.4092 20.2905 22.3633 20.2643 22.2977L19.6936 21.0199L18.2766 20.4104C18.211 20.3842 18.1651 20.3482 18.1389 20.3023C18.1126 20.2564 18.0995 20.2007 18.0995 20.1352C18.0995 20.0697 18.1126 20.014 18.1389 19.9681C18.1651 19.9222 18.211 19.8862 18.2766 19.86L19.6936 19.2505L20.2643 17.894C20.2905 17.8285 20.3266 17.7826 20.3725 17.7564C20.4185 17.7302 20.4742 17.7171 20.5398 17.7171C20.6054 17.7171 20.6612 17.7302 20.7071 17.7564C20.753 17.7826 20.7891 17.8285 20.8153 17.894L21.386 19.2505L22.803 19.86C22.8686 19.8862 22.9145 19.9222 22.9408 19.9681C22.967 20.014 22.9801 20.0697 22.9801 20.1352C22.9801 20.2007 22.967 20.2564 22.9408 20.3023C22.9145 20.3482 22.8686 20.3842 22.803 20.4104L21.386 21.0199L20.8153 22.2977C20.7891 22.3633 20.7497 22.4092 20.6973 22.4354C20.6448 22.4616 20.5923 22.4747 20.5398 22.4747ZM11.9003 19.0736C11.7953 19.0736 11.6937 19.0441 11.5953 18.9851C11.4969 18.9261 11.4214 18.8442 11.369 18.7394L10.0898 16.0067L7.33456 14.7681C7.2296 14.7157 7.1476 14.6404 7.08856 14.5421C7.02952 14.4438 7 14.3422 7 14.2373C7 14.1325 7.02952 14.0309 7.08856 13.9326C7.1476 13.8343 7.2296 13.759 7.33456 13.7065L10.0898 12.468L11.369 9.75497C11.4214 9.63701 11.4969 9.54854 11.5953 9.48957C11.6937 9.43059 11.7953 9.4011 11.9003 9.4011C12.0053 9.4011 12.1069 9.43059 12.2053 9.48957C12.3037 9.54854 12.3792 9.63046 12.4317 9.73531L13.7305 12.468L16.4661 13.7065C16.5841 13.759 16.6727 13.8343 16.7317 13.9326C16.7908 14.0309 16.8203 14.1325 16.8203 14.2373C16.8203 14.3422 16.7908 14.4438 16.7317 14.5421C16.6727 14.6404 16.5841 14.7157 16.4661 14.7681L13.7305 16.0067L12.4317 18.7394C12.3792 18.8573 12.3037 18.9425 12.2053 18.9949C12.1069 19.0474 12.0053 19.0736 11.9003 19.0736Z"
    141                         style="<?php echo esc_attr($this->get_style('icon_container')); ?>" />
    142                         </g>
    143                         <defs>
    144                         <filter id="filter0_dd_5_106" x="0.633232" y="0.438226" width="28.0017" height="29.5741" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">
    145                         <feFlood flood-opacity="0" result="BackgroundImageFix"/>
    146                         <feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/>
    147                         <feOffset dx="-1.31726" dy="2.48816"/>
    148                         <feGaussianBlur stdDeviation="2.52475"/>
    149                         <feComposite in2="hardAlpha" operator="out"/>
    150                         <feColorMatrix type="matrix" values="0 0 0 0 0.0506089 0 0 0 0 0.0159861 0 0 0 0 0.191833 0 0 0 0.25 0"/>
    151                         <feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow_5_106"/>
    152                         <feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/>
    153                         <feOffset dx="1.24408" dy="-1.1709"/>
    154                         <feGaussianBlur stdDeviation="2.19544"/>
    155                         <feComposite in2="hardAlpha" operator="out"/>
    156                         <feColorMatrix type="matrix" values="0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0.35 0"/>
    157                         <feBlend mode="normal" in2="effect1_dropShadow_5_106" result="effect2_dropShadow_5_106"/>
    158                         <feBlend mode="normal" in="SourceGraphic" in2="effect2_dropShadow_5_106" result="shape"/>
    159                         </filter>
    160                         </defs>
    161                     </svg>
    162                     <p><?php echo esc_html(get_option('postology_summary_heading_text', 'AI-generated article summary')); ?></p>
    163                 </section>
    164                 <div id="summary-content-placeholder" style="<?php echo esc_attr($this->get_style('summary_background')); ?>">
    165                     <div id="loading-placeholder">
    166                         <div class="loading-line"></div>
    167                         <div class="loading-line"></div>
    168                         <div class="loading-line"></div>
    169                         <div class="loading-line"></div>
    170                     </div>
    171                 </div>                   
    172                 <!-- "Powered by Postology" hidden initially -->
    173                 <?php if ($powered_by_option == "on"): ?>
    174                     <div class="postology-powered-by" style="<?php echo esc_attr($this->get_style('powered_by')); ?>">Postology</div>
    175                 <?php endif; ?>
    176             </div>
     153                <div id="summary-content" style="<?php echo esc_attr($this->get_style('inner_container')); ?>">
     154                    <section id="summary-title" style="<?php echo esc_attr($this->get_style('summary_heading_text')); ?>">
     155                        <svg width="29" height="31" viewBox="0 0 29 31" fill="none" xmlns="http://www.w3.org/2000/svg"
     156                        class="postology-box-icon">
     157                            <g filter="url(#filter0_dd_5_106)">
     158                            <path class="fill-path" d="M20.5398 10.7576C20.4742 10.7576 20.4185 10.7445 20.3725 10.7183C20.3266 10.6921 20.2905 10.6462 20.2643 10.5807L19.6936 9.24382L18.2569 8.61472C18.1913 8.5885 18.1454 8.55246 18.1192 8.50659C18.0929 8.46072 18.0798 8.40502 18.0798 8.33948C18.0798 8.27395 18.0929 8.21825 18.1192 8.17238C18.1454 8.12651 18.1913 8.09046 18.2569 8.06425L19.6936 7.45481L20.2643 6.17694C20.2905 6.1114 20.3266 6.06553 20.3725 6.03932C20.4185 6.01311 20.4742 6 20.5398 6C20.6054 6 20.6612 6.01311 20.7071 6.03932C20.753 6.06553 20.7891 6.1114 20.8153 6.17694L21.386 7.45481L22.8227 8.06425C22.8883 8.09046 22.9342 8.12651 22.9604 8.17238C22.9867 8.21825 22.9998 8.27395 22.9998 8.33948C22.9998 8.40502 22.9867 8.46072 22.9604 8.50659C22.9342 8.55246 22.8883 8.5885 22.8227 8.61472L21.386 9.24382L20.8153 10.5807C20.7891 10.6462 20.753 10.6921 20.7071 10.7183C20.6612 10.7445 20.6054 10.7576 20.5398 10.7576ZM20.5398 22.4747C20.4873 22.4747 20.4349 22.4616 20.3824 22.4354C20.3299 22.4092 20.2905 22.3633 20.2643 22.2977L19.6936 21.0199L18.2766 20.4104C18.211 20.3842 18.1651 20.3482 18.1389 20.3023C18.1126 20.2564 18.0995 20.2007 18.0995 20.1352C18.0995 20.0697 18.1126 20.014 18.1389 19.9681C18.1651 19.9222 18.211 19.8862 18.2766 19.86L19.6936 19.2505L20.2643 17.894C20.2905 17.8285 20.3266 17.7826 20.3725 17.7564C20.4185 17.7302 20.4742 17.7171 20.5398 17.7171C20.6054 17.7171 20.6612 17.7302 20.7071 17.7564C20.753 17.7826 20.7891 17.8285 20.8153 17.894L21.386 19.2505L22.803 19.86C22.8686 19.8862 22.9145 19.9222 22.9408 19.9681C22.967 20.014 22.9801 20.0697 22.9801 20.1352C22.9801 20.2007 22.967 20.2564 22.9408 20.3023C22.9145 20.3482 22.8686 20.3842 22.803 20.4104L21.386 21.0199L20.8153 22.2977C20.7891 22.3633 20.7497 22.4092 20.6973 22.4354C20.6448 22.4616 20.5923 22.4747 20.5398 22.4747ZM11.9003 19.0736C11.7953 19.0736 11.6937 19.0441 11.5953 18.9851C11.4969 18.9261 11.4214 18.8442 11.369 18.7394L10.0898 16.0067L7.33456 14.7681C7.2296 14.7157 7.1476 14.6404 7.08856 14.5421C7.02952 14.4438 7 14.3422 7 14.2373C7 14.1325 7.02952 14.0309 7.08856 13.9326C7.1476 13.8343 7.2296 13.759 7.33456 13.7065L10.0898 12.468L11.369 9.75497C11.4214 9.63701 11.4969 9.54854 11.5953 9.48957C11.6937 9.43059 11.7953 9.4011 11.9003 9.4011C12.0053 9.4011 12.1069 9.43059 12.2053 9.48957C12.3037 9.54854 12.3792 9.63046 12.4317 9.73531L13.7305 12.468L16.4661 13.7065C16.5841 13.759 16.6727 13.8343 16.7317 13.9326C16.7908 14.0309 16.8203 14.1325 16.8203 14.2373C16.8203 14.3422 16.7908 14.4438 16.7317 14.5421C16.6727 14.6404 16.5841 14.7157 16.4661 14.7681L13.7305 16.0067L12.4317 18.7394C12.3792 18.8573 12.3037 18.9425 12.2053 18.9949C12.1069 19.0474 12.0053 19.0736 11.9003 19.0736Z"
     159                            style="<?php echo esc_attr($this->get_style('icon_container')); ?>" />
     160                            </g>
     161                            <defs>
     162                            <filter id="filter0_dd_5_106" x="0.633232" y="0.438226" width="28.0017" height="29.5741" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">
     163                            <feFlood flood-opacity="0" result="BackgroundImageFix"/>
     164                            <feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/>
     165                            <feOffset dx="-1.31726" dy="2.48816"/>
     166                            <feGaussianBlur stdDeviation="2.52475"/>
     167                            <feComposite in2="hardAlpha" operator="out"/>
     168                            <feColorMatrix type="matrix" values="0 0 0 0 0.0506089 0 0 0 0 0.0159861 0 0 0 0 0.191833 0 0 0 0.25 0"/>
     169                            <feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow_5_106"/>
     170                            <feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/>
     171                            <feOffset dx="1.24408" dy="-1.1709"/>
     172                            <feGaussianBlur stdDeviation="2.19544"/>
     173                            <feComposite in2="hardAlpha" operator="out"/>
     174                            <feColorMatrix type="matrix" values="0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0.35 0"/>
     175                            <feBlend mode="normal" in2="effect1_dropShadow_5_106" result="effect2_dropShadow_5_106"/>
     176                            <feBlend mode="normal" in="SourceGraphic" in2="effect2_dropShadow_5_106" result="shape"/>
     177                            </filter>
     178                            </defs>
     179                        </svg>
     180                        <p><?php echo esc_html(get_option('postology_summary_heading_text', 'AI-generated article summary')); ?></p>
     181                    </section>
     182                    <div id="summary-content-placeholder" style="<?php echo esc_attr($this->get_style('summary_background')); ?>">
     183                        <div id="loading-placeholder">
     184                            <div class="loading-line"></div>
     185                            <div class="loading-line"></div>
     186                            <div class="loading-line"></div>
     187                            <div class="loading-line"></div>
     188                        </div>
     189                    </div>                   
     190                    <!-- "Powered by Postology" hidden initially -->
     191                    <?php if ($powered_by_option == "on"): ?>
     192                        <div class="postology-powered-by" style="<?php echo esc_attr($this->get_style('powered_by')); ?>">Postology</div>
     193                    <?php endif; ?>
     194                </div>
     195            </postology-el>
    177196            <?php
    178197            $postology_box = ob_get_clean();
     
    352371                $styles['background-color'] = get_option('postology_button_background_color', '#FFFFFF');
    353372                $styles['border'] = '1px solid ' . get_option('postology_button_border_color', '#E2E8F0');
    354                 $styles['border-radius'] = get_option('postology_button_border_radius', '12px');
     373                $styles['border-radius'] = get_option('postology_button_border_radius', '9px');
    355374                break;
    356375            case 'bullet_points_text':
     
    363382            case 'main_container':
    364383                $styles['background-color'] = get_option('postology_main_container_background_color', '#FFFFFF');
    365                 $styles['border-radius'] = get_option('postology_main_container_border_radius', '12px');
     384                $styles['border-radius'] = get_option('postology_main_container_border_radius', '9px');
    366385                $styles['border'] = '0px solid ' . get_option('postology_main_container_border_color', '#000000');
    367386                $styles['box-shadow'] = get_option('postology_main_container_border_shadow', '3px 12px 15px 3px rgba(0, 0, 0, 0.1)');
     
    369388            case 'inner_container':
    370389                $styles['background-color'] = get_option('postology_inner_container_background_color', '#FFFFFF');
    371                 $styles['border-radius'] = get_option('postology_inner_container_border_radius', '12px');
     390                $styles['border-radius'] = get_option('postology_inner_container_border_radius', '9px');
    372391                $styles['border'] = '0px solid ' . get_option('postology_inner_container_border_color', '#000000');
    373392                $styles['box-shadow'] = get_option('postology_inner_container_border_shadow', '3px 12px 15px 3px rgba(0, 0, 0, 0.1)');
  • postology/trunk/readme.txt

    r3274349 r3284680  
    66Tested up to: 6.7 
    77Requires PHP: 7.2 
    8 Stable tag: 1.1 
     8Stable tag: 1.2 
    99License: GPL-2.0-or-later 
    1010License URI: http://www.gnu.org/licenses/gpl-2.0.html 
Note: See TracChangeset for help on using the changeset viewer.