Yesterday I said, How to compress jquery.js In fact, it's just my help. There is no solution. Vango left a message saying that jquery The version of. js 1.1 was tested just now, and the foreground is OK. In fact, I don't know where the foreground needs to be used, so I haven't removed the foreground load temporarily. However, when I change to jquery When. js 1.1 was released, there was a problem in the background. The most obvious problem was the visual editing of the editor, which directly led to the blank screen of my blog yesterday afternoon
After using 1.1, there are other small problems. When adding articles in the background, tags cannot be added and article categories cannot be added. I found these problems for the time being. I think there should be other problems. I'm too lazy to test them one by one. I'd better switch back to version 1.3.2
Is that all I can do? No, since the 1.1 version can't be used, but there is Google Google Ajax library can be used directly http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js The files here have been compressed. It seems to be 19K. Compared with 56K, it's almost 40K If it is used directly, it is to change the script loader. php file under wp includes. The problem is that the editor is not visible, which is unpleasant
Okay, don't be afraid, go on Google OK. The near perfect solution appears in front of me. It is to judge whether it is the background. If it is the background, load the original jquery . js, otherwise load Google Ajax library. How to do it specifically? In fact, it's very simple. I'm the leader. I'll tell you later where the original link is
wp- includes Lower script -Loader.php, about 120 lines, contains the following code:
$scripts->add( 'jquery', '/wp-includes/js/jquery/jquery.js', false, '1.3.2');
This is the modification. Why? Next look:
if(strpos($_SERVER['REQUEST_URI'], '/wp-admin/') != false) { $scripts->add( 'jquery', '/wp-includes/js/jquery/jquery.js', false, '1.3.2'); }else{ $scripts->add( 'jquery', ' http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js ', false, '1.3.2'); }
Determine whether it is in the background. If yes, load the original js, otherwise load Gogole's. Continue testing, OK
I still found a problem. I don't know why. After switching, the editor visualization is available, but I can't switch to html mode Just change back to the original. I don't understand why
The methods in the article come from: Tuya Thank you!