Plugin Directory

Changeset 2526038


Ignore:
Timestamp:
05/04/2021 03:07:53 PM (5 years ago)
Author:
mendibass
Message:

color posts not just pages, bug fixed, bit design

Location:
browser-address-bar-color
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • browser-address-bar-color/tags/1.2/browserAddressBarColor.php

    r2521602 r2526038  
    102102                <!-- Chrome, Samsung internet -->
    103103                <meta name="theme-color" content="<?php echo $babc_pages_list["all"]; ?>">
    104                 <!-- Windows Phone -->
    105                 <meta name="msapplication-navbutton-color" content="<?php echo $babc_pages_list["all"]; ?>">
    106                 <!-- iOS Safari -->
    107                 <meta name="apple-mobile-web-app-status-bar-style" content="<?php echo $babc_pages_list["all"]; ?>">
    108                 <meta name="theme-color" content="<?php echo $babc_pages_list["all"]; ?>">
    109104                <?php
    110105            }
     
    115110                    ?>
    116111                    <!-- Chrome, Samsung internet -->
    117                     <meta name="theme-color" content="<?php echo $color; ?>">
    118                     <!-- Windows Phone -->
    119                     <meta name="msapplication-navbutton-color" content="<?php echo $color; ?>">
    120                     <!-- iOS Safari -->
    121                     <meta name="apple-mobile-web-app-status-bar-style" content="<?php echo $color; ?>">
    122112                    <meta name="theme-color" content="<?php echo $color; ?>">
    123113                    <?php
  • browser-address-bar-color/trunk/babcScript.js

    r2521591 r2526038  
    33const babc_txt_cover_input = document.getElementsByClassName("txt-cover-input");
    44const babc_check_cover_input = document.getElementsByClassName("check-cover-input");
     5
     6const babc_main_div = document.getElementById("babc_main_div");
    57const babc_inp_all = document.getElementById("input_all");
    68const babc_cbox_all = document.getElementById("cbox_all");
     
    5254        babc_check_inputs_list[i].style.display = "none";
    5355        babc_check_cover_input[i].style.display = "inline-block";
    54           babc_txt_cover_input[i].style.display = "block";
     56        babc_txt_cover_input[i].style.display = "block";
    5557      }
    5658      if(!babc_cbox_all.checked){
    5759        babc_check_cover_input[i].style.display = "none";
    58           babc_check_inputs_list[i].style.display = "inline-block";
     60        babc_check_inputs_list[i].style.display = "inline-block";
    5961
    6062          if(babc_check_inputs_list[i].checked){
     
    7072  babc_check_inputs_list[i].addEventListener("click",()=>{
    7173      if(!babc_cbox_all.checked){
    72           setTimeout(() => {
    7374            if(babc_check_inputs_list[i].checked){
    7475              babc_color_inputs_list[i].style.display = "block";
     
    7980              babc_txt_cover_input[i].style.display = "block";
    8081            } 
    81           }, 1); // making this change async
    8282      }
    8383  });
    8484};
     85
     86function displaySettings(){
     87  babc_main_div.style.visibility  = "visible";
     88}
     89displaySettings();//display the main div after building all inputs set
     90
  • browser-address-bar-color/trunk/babcSettingsPage.php

    r2521591 r2526038  
    1 <div style="margin-right:10%;  margin-left: 10px; margin-top: 20px;">
     1<div id="babc_main_div" style="visibility:hidden; margin-right:10%;  margin-left: 10px; margin-top: 20px;">
    22        <div style="color: #6E7274; text-align:left;">
    33            <h2 style="margin-left: 10px; color: #6E7274; font-size: 35px; font-weight: 600; text-align:<?php echo (get_user_locale() == "he_IL") ? "right" : "left" ?>;"> <?php echo esc_html_e( 'Browser Address Bar Color', 'browser-address-bar-color' ) ?>
     
    1313                <div style="float: left;">
    1414                    <input type="checkbox" id="cbox_all" name="check-color-all" style=" " <?php echo isset(get_option('babc_pages_list')["all"]) ? "checked" : null; ?>>
    15                     <p style="color: #3e4347; display: inline; font-weight: 600;"> <?php echo esc_html_e( 'All pages:', 'browser-address-bar-color' ) ?> </p>
     15                    <p style="color: #3e4347; display: inline; font-weight: 600;"> <?php echo esc_html_e( 'All pages and posts: ', 'browser-address-bar-color' ) ?> </p>
    1616                </div>
    17                <input type="color" id="input_all" name="input-color-all" style="width:50%; padding: 2px 8px; height:35px; float: right; box-shadow: 0px 0px 13px rgba(0, 0, 0, 0.1);" value="<?php echo get_option('babc_pages_list')["all"];?>">
     17               <input type="color" id="input_all" name="input-color-all" style="width:50%; padding: 2px 8px; height:35px; float: right; box-shadow: 0px 0px 13px rgba(0, 0, 0, 0.1);" <?php echo 'value="'.get_option('babc_pages_list')["all"].'"';?>>
    1818               <input type="text" id="txt-cover-inp-all" style="width:50%; padding: 2px 8px; height:35px; float: right; display:none;" value="Not Selected" disabled>
    1919              </div>
    20               <hr style="width: 80%; font-weight: 600; color: #000; border-width: 2px;">
     20   
     21              <?php
    2122
    22               <?php
     23                if(get_pages()[0]->ID){
     24                    echo'<hr style="width: 80%; font-weight: 600; color: #000; border-width: 2px;">
     25                    <h3>Pages:</h3>';
     26                }
     27
    2328                $babcAllPages = get_pages();
    2429                $babc_curr_pages_arr = get_option('babc_pages_list');
     
    5964                }
    6065                ?>
     66               
     67                <?php
     68                 if(get_posts()[0]->ID){
     69                    echo'<hr style="width: 80%; font-weight: 600; color: #000; border-width: 2px;">
     70                    <h3>Posts:</h3>';
     71                 }
     72                $babcAllPosts = get_posts();
     73                $babc_curr_pages_arr = get_option('babc_pages_list');
     74               
     75                foreach ($babcAllPosts as $post) {
     76                    if(array_key_exists($post->ID , $babc_curr_pages_arr)){
     77                        $curr_checked = "checked";
     78                        $curr_color = $babc_curr_pages_arr[$post->ID];
     79                    }else{
     80                       $curr_checked = "";
     81                       $curr_color = "#E3E3E3" ; //default color;
     82                    }
     83 
     84                    $babc_option = '<div style="background-color: #fff; padding: 4px; padding-bottom: 0px; direction: ltr; margin-top: 5px; height:40px;">';
     85                   
     86                        $babc_option .= '<div style="float: left;">';
     87                            $babc_option .= ' <input type="checkbox" id="" class="check-inputs" name="check-color-';
     88                            $babc_option .= $post->ID;
     89                            $babc_option .= '" style="display:inline-block;" ';
     90                            $babc_option .= $curr_checked;
     91                            $babc_option .= '>';
     92                            $babc_option .= '<input type="checkbox" class="check-cover-input" style="display: none;" checked disabled>';
     93                            $babc_option .= '<p style="color: #0970be; display: inline; font-weight: 600;">';
     94                            $babc_option .= $post->post_title;
     95                            $babc_option .= ':</p>';
     96                        $babc_option .= '</div>';
     97               
     98                        $babc_option .= '<input type="color" class="color-inputs" name="input-color-';
     99                        $babc_option .= $post->ID;
     100                        $babc_option .= '" style="width:50%; padding: 2px 8px; height:35px; float: right; box-shadow: 0px 0px 13px rgba(0, 0, 0, 0.1);" value="';
     101                        $babc_option .= $curr_color;
     102                        $babc_option .= '">';
     103                        $babc_option .= '<input type="text" class="txt-cover-input" style="display: none; width:50%; padding: 2px 8px; height:35px; float: right;" value="Not Selected" disabled> ';
     104                   
     105
     106                    $babc_option .= '</div>';
     107                    echo $babc_option;
     108                }
     109                ?>
    61110            </div>
    62111           
  • browser-address-bar-color/trunk/browserAddressBarColor.php

    r2521602 r2526038  
    3737}
    3838
    39 
    4039function babcLinkToSettingsPage($links) {
    4140    $babc_settings_link = '<a href="themes.php?page=babc-options">Settings</a>';
     
    4948
    5049    wp_enqueue_script( 'babc-script', plugins_url('babcScript.js', __FILE__ ));
    51     wp_enqueue_style( 'Roboto', 'https://fonts.googleapis.com/css?family=Roboto&display=swap');
    5250
    5351    if(isset($_POST['color-posted'])){
     
    102100                <!-- Chrome, Samsung internet -->
    103101                <meta name="theme-color" content="<?php echo $babc_pages_list["all"]; ?>">
    104                 <!-- Windows Phone -->
    105                 <meta name="msapplication-navbutton-color" content="<?php echo $babc_pages_list["all"]; ?>">
    106                 <!-- iOS Safari -->
    107                 <meta name="apple-mobile-web-app-status-bar-style" content="<?php echo $babc_pages_list["all"]; ?>">
    108                 <meta name="theme-color" content="<?php echo $babc_pages_list["all"]; ?>">
    109102                <?php
    110103            }
     
    112105        }else{
    113106            foreach ($babc_pages_list as $page => $color) {
    114                 if (is_page($page)){
     107                if (is_page($page) || is_single($page)){
    115108                    ?>
    116109                    <!-- Chrome, Samsung internet -->
    117110                    <meta name="theme-color" content="<?php echo $color; ?>">
    118                     <!-- Windows Phone -->
    119                     <meta name="msapplication-navbutton-color" content="<?php echo $color; ?>">
    120                     <!-- iOS Safari -->
    121                     <meta name="apple-mobile-web-app-status-bar-style" content="<?php echo $color; ?>">
    122                     <meta name="theme-color" content="<?php echo $color; ?>">
    123111                    <?php
    124112                };
    125             } //loop over $babc_pages_list, check every page, and call by color;
     113            } //loop over $babc_pages_list, check every page and post, and call by color;
    126114        }
    127115
  • browser-address-bar-color/trunk/readme.txt

    r2523609 r2526038  
    1111Requires at least: 4.6
    1212Tested up to: 5.7
    13 Stable tag: 1.2
     13Stable tag: 2.0
    1414
    1515== Description ==
     
    4545= 1.0 =
    4646* First upload
    47 = 1.2 =
    48 * Prepare for translations
     47= 2.0 =
     48* Option to color single post, bug fixed
     49
     50== Upgrade Notice ==
     51= 2.0 =
     52bug fixed, color single post- not just pages
    4953
    5054== Frequently Asked Questions ==
     
    5256= What's your plugin's specialty? =
    5357
    54 You can choose different colors for each page of your site, not only one for all of them
     58You can choose different colors for each page of your site or even every post, not only one for all of them
    5559
    5660= Why it doesn't work on desktop browsers? =
     
    5862For now the plugin is not functional in desktop browsers but according to google it should be available soon in chrome for PC.
    5963
    60 == Upgrade Notice ==
    61 
    6264== Donations ==
Note: See TracChangeset for help on using the changeset viewer.