handsome final magic change

Posted by leebo on Thu, 27 Jan 2022 05:12:03 +0100

All the styles of this site come from God stands for Qi Lin

This magic change needs to modify the source file. Please back it up before you start

This article magic change tutorial, only take the modification process of this site as an example Magic reform course

Download style file

Download css to and place the file in / usr/themes/handsome/assets/css

Both styles of this site are OK, but mine has been changed to other styles

God on behalf of Qi Lin style

Import style file

1. Open / usr / themes / handsome / component / header PHP 2. Find and add a line above. The modified code is

    <!-- local css Static resources -->
    <link rel="stylesheet" href="<?php echo STATIC_PATH; ?>css/function.min.css?v=<?php echo Handsome::$version.Handsome_Config::$versionTag ?>" type="text/css" />
    <link rel="stylesheet" href="<?php echo STATIC_PATH; ?>css/handsome.min.css?v=<?php echo Handsome::$version.Handsome_Config::$versionTag ?>" type="text/css" />
    <link rel="stylesheet" href="<?php echo STATIC_PATH; ?>css/handsome.css?v=1.6.4" type="text/css">
    <!--Theme component css File loading-->

Enter the appearance setting and close the box model

Embedding point of background image

1. Open / usr / themes / handsome / component / headnav PHP 2. Add a line after the first line

<div id="bg"></div>

Background picture settings

1. Open / usr / themes / handsome / assets / CSS / handsome CSS, search for img/bg on line 16. I changed it to the external chain picture. The front picture is the link, the PC background picture, and the back picture is the web background picture. The background picture of Dai Qilin style is BG1 Jpg is the background image of PC page. bg2.jpg is the background image of the mobile phone page.

Download js file

Download js file

Put this file in the following path of typecho: / usr / themes / handsome / assets / JS / qicloud Min.js and then open / usr / themes / handsome / component / footer PHP, search, add a line at the end, and the following is the code after adding

This site js is not compressed. See the function for yourself

<!--Theme core js-->
    <script src="<?php echo STATIC_PATH ?>js/function.min.js?v=<?php echo Handsome::$version.Handsome_Config::$versionTag
    ?>"></script>
    <script src="<?php echo STATIC_PATH ?>js/core.min.js?v=<?php echo Handsome::$version.Handsome_Config::$versionTag
?>"></script>
    <script type="text/javascript" src="<?php echo STATIC_PATH; ?>js/qicloud.min.js"></script>

Sticky Posts

Use handsome's own plug-in article header style to select small board

If you want to get the same topping effect as the leader of shendai Qilin, you have to change it

usr/plugins/Handsome/Plugin.php found 766 lines of $sticky_html changed to

$sticky_html = '<span class="sticky label text-base bg-danger" style="margin-top:  2px;">' . _t("Topping") . '</span>';

Indicate the author information of the magic reform theme

Theme modified by <a href="https://moe.best" target="_blank">Jindai Kirin</a>&nbsp;|&nbsp;

The following tutorials are from the network FAQ 1. The article appears with a white background 1. Go to the file / usr / themes / handsome / assets / CSS / handsome Min.css, 2. CTRL+F search entry content {background: #fff}#post content, 3. Modify #fff to #fff0

2, Unable to click the image on the main page to enter the article HTML optimization method 1. Open / usr / themes / handsome / LIBS / content PHP, find the comment. 2. Add a line below

<a href="{$parameterArray['linkUrl']}" class="ahover"></a>

3, The right sidebar is opaque. 1. Open / usr / themes / handsome / component / sidebar PHP, 2. Find

<aside class="asideBar col w-md bg-white-only b-l bg-auto no-border-xs" role="complementary">

Delete BG auto and change to

<aside class="asideBar col w-md bg-white-only b-l no-border-xs" role="complementary">

4, When both articles on the home page are small header images, they cannot be displayed in parallel. 1. Open / usr / themes / handsome / LIBS / content PHP, find the comment. 2. Delete EOF below it; Empty lines between.

5, Solve the problem that the directory will be hidden when scrolling down the article page. 1. Open / usr / themes / Handsome / assets / JS / Handsome JS, search #sidebar. 2. Var a = $("#sidebar") children(); Replace with var a = $("#sidebar") find("section");. 6, When the top article of the small header is in the small screen state, there is a white edge at the bottom of the picture. Open the setting appearance menu of Handsome theme, and add the following content in developer Settings > Custom CSS.

.panel-small>.post-meta {
    padding-bottom: 0 !important;
}

Warning again, back up first!!

Modify the avatar in the right column / usr/themes/handsome/assets/img/sj2 and upload it to this folder. Find the map yourself. You can get the map on this site. Don't fool around and download the avatar

Article header / usr/themes/handsome/assets/img/sj

emm I have too many, I post code, you collect it yourself

    set_time_limit(0);
    class Http
    {
        private $curl;

        function __construct()
        {
            //Initialize curl
            $this->curl = curl_init();
        }

        public function getUrl($url, $header = array('Accept-Encoding: gzip, deflate'), $ssl = true)
        {
            curl_setopt($this->curl, CURLOPT_URL, $url); //Set the URL of the request
            curl_setopt($this->curl, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows NT 6.2; WOW64; rv:34.0) Gecko/20100101 Firefox/34.0"); //The HTTP request contains a string with a "user agent:" header.
            curl_setopt($this->curl, CURLOPT_HTTPHEADER, $header); //Set request header
            curl_setopt($this->curl, CURLOPT_RETURNTRANSFER, true); //Set TRUE to curl_ The exec () result is converted to a string instead of being output directly
            curl_setopt($this->curl, CURLOPT_CUSTOMREQUEST, "GET"); //Set request mode
            curl_setopt($this->curl, CURLOPT_CONNECTTIMEOUT, 60); /* The time to wait before initiating the connection. If it is set to 0, it will wait indefinitely */
            curl_setopt($this->curl, CURLOPT_TIMEOUT, 7); /* Set the maximum number of seconds that cURL is allowed to execute */
            if ($ssl) {
                curl_setopt($this->curl, CURLOPT_SSL_VERIFYPEER, FALSE); // https requests do not validate certificates and hosts
                curl_setopt($this->curl, CURLOPT_SSL_VERIFYHOST, FALSE); // Do not check whether the SSL encryption algorithm exists from the certificate
            }
            curl_setopt($this->curl, CURLOPT_FOLLOWLOCATION, 1);
            curl_setopt($this->curl, CURLOPT_MAXREDIRS, 2);/*Specify the maximum number of HTTP redirects. This option is and curlopt_ Used with followlocation*/
            curl_setopt($this->curl, CURLOPT_ENCODING, 'gzip,deflate'); //This is to explain the gzip content

            $res = curl_exec($this->curl);
            return $res;
        }

        public function  grabImage($url, $filename = "")
        {
            if ($url == "") return false; //If the $url address is empty, exit directly
            if ($filename == "") //If no new file name is specified
            {
                $ext = strrchr($url, ".");  //Get the image format of $url
                $filename = date("Ymd") . $ext;  //Name the new file with the hour, minute and second of the sky and moon
            }
            ob_start();         //Open output
            readfile($url);     //Output picture file
            $img = ob_get_contents();   //Get browser output
            ob_end_clean();             //Clear output and close
            $fp2 = @fopen($filename, "a");
            fwrite($fp2, $img);         //Write a picture file to the current directory and rename it
            fclose($fp2);
            return $filename;           //Returns a new file name
        }
    }
        $path = './touxiang1/'; //route
        $a = new Http();
        $s = '200'; //The number of cycles, the number of cycles, is the number of sheets
        for ($i = 0; $i < $s; $i++) {
            $url = 'http://api.btstu.cn/sjbz/api.php?lx=dongman&format=json';
            $data = $a->getUrl($url);
            $data = json_decode($data, true);
            $imgurl = $data['imgurl'];
            $time = md5(date("Ymdhis", time()) + $i);
            $filename =  $time . '.jpg';  //Name the new file name with month, year and day
            $img = $a->grabImage($imgurl, $path . '/' . $filename); //Read and save pictures
            echo $img . "<br>";
        }

Just find a way to check the weight,

Well, I also wrote the batch renaming of files in the directory

    <?php
    $dir1 = './touxiang/1/'; //Read folder name (avoid using Chinese)
    $dir2 = './touxiang/';  //Move to folder name (avoid using Chinese)
    $filearr = scandir($dir1); //Read folder
    unset($filearr[0]); //Remove excess elements
    unset($filearr[1]);
    $filearr = array_values($filearr); //Start the array with 0 and increment with 1
    $filecount = count($filearr); //Number of documents
    $onenum = 1; //Starting number
    $maxnum = $onenum + $filecount; //Maximum number of cycles
    //$title = ''; // Document title
    $houzhui = '.jpg'; //file extension
    for ($i = $onenum; $i <= $maxnum; $i++) {
        for ($j = 0; $j < $filecount; $j++) {
            if ($i < 10) {
            }
            rename($dir1 . $filearr[$j], $dir2 . /*$title . */$i . $houzhui);
            $i++;
        }
    }

I'll see you when I finish my work