鱼C论坛

 找回密码
 立即注册
查看: 5596|回复: 17

[吹水] 扒鱼C首页全过程,鱼哥莫怪,嘿嘿

[复制链接]
发表于 2012-11-25 05:35:16 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能^_^

您需要 登录 才可以下载或查看,没有账号?立即注册

x
其实,东西并不难做,只是懒啊懒...有现成的,干嘛要做呢。。于是呼,操起Chrome杀向鱼C。。

1.打开Chrome。。打开鱼C首页 。。68个请求。
翻到首页代码。发现鱼C的首页竟然还有老外的注释(偷笑,原来鱼哥也是扒的)。

我习惯从上往下看,好吧。除了注释 ,直接第一行代码
  1. <link rel="stylesheet" type="text/css" href="lib/style.css">
复制代码

嗯。CSS,加上鱼C的URL,访问瞧瞧是啥。看完傻了,哇靠,老外的代码风格写的真漂亮。羡慕一翻。


之后继续扒。除了JQuery和他的插件,继续向下看。。
看到Source.js,顿时又尿了,哇靠,面向对象啊。。俺刚学到面向对象。。
不过大牛写的东西就是容易,简单易懂啊。。
  1. var hoverEffect = true; // set true for hover effect, set false for no hover effect

  2. var searchEngine = 'google'; // default search engine - set google for google search, bing for bing search, yahoo for yahoo search

  3. var numberOfScreens = 3; // set number of screens (1 or 2 or 3)

  4. var blockName = new Array(); // set names of blocks
  5. blockName[1] = '鱼C工作室';
  6. blockName[2] = '常用导航';
  7. blockName[3] = '娱乐导航';

  8. var bookmark = new Array();
  9. bookmark[0] = new Array();
  10. bookmark[1] = new Array();
  11. bookmark[2] = new Array();

  12. // set your bookmarks here: (If you do not fill 'thumb' for thumbnail will be used title)
  13. // FIRST BLOCK
  14. bookmark[0][0] = {
  15.         'title':'天气预报',
  16.         'url':'http://www.thinkpage.cn',
  17.         'thumb':'../lib/1.png'
  18. };
复制代码
好吧,这么简单,继续向下看吧。。

看到script.js中是网页加载完毕之后运行的...忽略,先看网页。。看完之后再分析这个JS。

看了看网页,实在是简单的没话写了。。好吧。唯一可说的,就是每个图片都是png透明的。每一个DIV都有一个颜色。。

最后藏了一个百度的统计。

话说,背景图片真是大,嘿嘿。

最后,开始分析script.js
  1. $(document).ready(function(){
  2.         var num = numberOfScreens;//拿到当前所有的页数

  3.         for(var i=1;i<=num;i++){
  4.                 $('#name'+i).html(blockName[i]);//把所有的标题给初始化
  5.         }

  6. //下面的代码是给head标签中加一个<style>,本机测试,没什么作用,删了也没负画影响。。
  7.         if(hoverEffect){
  8.                 for(i=1;i<=num;i++){
  9.                         $('<style>#wrapper'+i+' div:hover{border: 1px #fff solid;box-shadow: 0px 0px 5px #fff;margin-left:4px;margin-top:4px;}</style>').appendTo('head');
  10.                 };
  11.         };
  12.         //这就不用说了吧。搜索引擎。
  13.         if(searchEngine=='google'){
  14.                 search='http://www.google.com/search';
  15.         }
  16.         else if(searchEngine=='bing'){
  17.                 search='http://www.bing.com/search';
  18.         }
  19.         else if(searchEngine=='yahoo'){
  20.                 search='http://search.yahoo.com/bin/search';
  21.         }
  22.         else{
  23.                 search='http://www.google.com/search';
  24.                 searchEngine='google';
  25.         };
  26. 给from表彰加个action属性...跳到search。。给输入框加一个引擎标签,说实话,CSS我不行。。
  27.         $('form').attr('action',search);
  28.         $('input:text').css('background','#fff url(lib/'+searchEngine+'-back.png) center right no-repeat');
  29. //算屏幕的宽和高。。用选择器没啥必要吧?
  30.         var windowWidth = $(window).width();
  31.         var windowHeight = $(window).height();
  32.         var left1 = Math.floor((windowWidth - 975)/2);
  33.         var left2 = left1 - 1045;
  34.         var left3 = left1 - 2090;
  35.         var wrapperTop = Math.floor((windowHeight - 480)/2)-80;
  36. //输入框获取焦点
  37.         $('#place').css({'left':left1,'top':15});
  38.         var wrapperPos = 1;
  39.         $('#wrapper1 input:text').focus();
  40.         var animDone = true;//暂时不懂啥意思
  41.         //界面1到界面2的时候,第一个框推动焦点,第二个框获取焦点
  42.         function anim1to2(){
  43.                 $('#wrapper1 input:text').focusout();
  44.                 animDone = false;//这是干啥的?
  45.                 $('#place').animate({
  46.                         left: left2
  47.                 },1000,'circEaseOut',function() {
  48.                         $('#wrapper2 input:text').focus();
  49.                         animDone = true;//这是干啥的?好像没鸟用啊
  50.                         wrapperPos = 2;//位置2
  51.                 });
  52.                 $('#button1to2').hide();                       
  53.                 $('#button2to1').show();
  54.                 if(num>2){
  55.                         $('#button2to3').show();
  56.                         $('#button3to2').hide();
  57.                 };
  58.         };
  59.        
  60.         function anim2to1(){
  61.                 $('#wrapper2 input:text').focusout();
  62.                 animDone = false;
  63.                 $('#place').animate({
  64.                         left: left1
  65.                 },1000,'circEaseOut',function() {
  66.                         $('#wrapper1 input:text').focus();
  67.                         animDone = true;
  68.                         wrapperPos = 1;
  69.                 });
  70.                 $('#button1to2').show();                       
  71.                 $('#button2to1').hide();
  72.                 if(num>2){
  73.                         $('#button2to3').hide();
  74.                         $('#button3to2').hide();
  75.                 };               
  76.         };
  77.        
  78.         function anim2to3(){
  79.                 $('#wrapper2 input:text').focusout();
  80.                 animDone = false;
  81.                 $('#place').animate({
  82.                         left: left3
  83.                 },1000,'circEaseOut',function() {
  84.                         $('#wrapper3 input:text').focus();
  85.                         animDone = true;
  86.                         wrapperPos = 3;
  87.                 });
  88.                 $('#button1to2').hide();
  89.                 $('#button3to2').show();
  90.                 $('#button2to1').hide();
  91.                 $('#button2to3').hide();       
  92.         };
  93.        
  94.         function anim3to2(){
  95.                 $('#wrapper3 input:text').focusout();
  96.                 animDone = false;
  97.                 $('#place').animate({
  98.                         left: left2
  99.                 },1000,'circEaseOut',function() {
  100.                         $('#wrapper2 input:text').focus();
  101.                         animDone = true;
  102.                         wrapperPos = 2;
  103.                 });
  104.                 $('#button1to2').hide();
  105.                 $('#button3to2').hide();
  106.                 $('#button2to1').show();
  107.                 $('#button2to3').show();                       
  108.         };
  109.        
  110. //不多说了,都一样。。
  111.         if(num>1){
  112.                 $('#button1to2').click(function(){
  113.                         anim1to2();
  114.                 });
  115.                
  116.                 $('#button2to1').click(function(){
  117.                         anim2to1();
  118.                 });
  119.                
  120.                 if(num>2){
  121.                         $('#button2to3').click(function(){
  122.                                 anim2to3();
  123.                         });
  124.                        
  125.                         $('#button3to2').click(function(){
  126.                                 anim3to2();
  127.                         });
  128.                 };
  129.         };

  130. //绑定事件键盘抬起的时候..如果等于左或者右
  131.         $(document).bind('keydown',function(event){
  132.                 if(event.keyCode == '39' || event.keyCode == '37'){
  133.                         event.preventDefault();
  134.                 }
  135.                 if(event.which=='39' && animDone){//终于明白后面的标志量是干啥的了。
  136.                        
  137.                         if(wrapperPos==1 && num>1){
  138.                                 anim1to2();
  139.                         };
  140.                         if(wrapperPos==2 && num>2){
  141.                                 anim2to3();
  142.                         };
  143.                 };
  144.                 if(event.which=='37' && animDone){
  145.                        
  146.                         if(wrapperPos==3){
  147.                                 anim3to2();
  148.                         };
  149.                         if(wrapperPos==2){
  150.                                 anim2to1();
  151.                         };                       
  152.                 };
  153.         });

  154. //绑定鼠标滚轮事件
  155.         $(document).mousewheel(function(event, delta) {
  156.                 if (delta > 0 && animDone){
  157.                         if(wrapperPos==3){
  158.                                 anim3to2();
  159.                         };
  160.                         if(wrapperPos==2){
  161.                                 anim2to1();
  162.                         };
  163.                 }
  164.                 else if (delta < 0 && animDone){
  165.                         if(wrapperPos==1 && num>1){
  166.                                 anim1to2();
  167.                         };
  168.                         if(wrapperPos==2 && num>2){
  169.                                 anim2to3();
  170.                         };
  171.                 };               
  172.                 event.preventDefault();               
  173.         });

  174. //给每个DIV赋值...
  175.         var j=0;
  176.         for (j=0; j <= (num-1); j++) {               
  177.                 for(i=0;i<=11;i++){                                                               
  178.                         var title = bookmark[j][i]['title'];
  179.                         var url = bookmark[j][i]['url'];
  180.                         var thumb = bookmark[j][i]['thumb'];
  181.                         if(thumb==''){
  182.                                 $('#thumb'+(j+1)+'-'+(i+1)).html('<img id="net" src="lib/net-back.png" /><a href="'+url+'" target="_blank"><div class="title">'+title+'</div></a>');
  183.                         }
  184.                         else{
  185.                                 $('#thumb'+(j+1)+'-'+(i+1)).html('<a href="'+url+'" target="_blank"><img src="thumbs/'+thumb+'" /></a>');
  186.                         }
  187.                 };
  188.         };
  189.         //看到这时,顿悟上面CSS的作用。偏移一下,把按钮重叠到input上,下面是绑定按钮单击事件
  190.         $('#search-engine1').click(function() {
  191.                 $('#engines1').fadeToggle('fast','circEaseOut');
  192.                 $('#wrapper1 input:text').css('background','#fff');
  193.         });
  194.        
  195.         $('#google1').click(function() {
  196.                 $('#wrapper1 form').attr('action','http://www.google.com/search');
  197.                 $('#engines1').fadeToggle('fast','circEaseOut');
  198.                 $('#wrapper1 input:text').css('background','#fff url(lib/google-back.png) center right no-repeat');
  199.                 $('#wrapper1 input:hidden').detach();
  200.                 $('#wrapper1 input:first').attr('name','q');
  201.                 $('#wrapper1 input:text').focus();
  202.         });
  203.        
  204.         $('#bing1').click(function() {
  205.                 $('#wrapper1 form').attr('action','http://www.bing.com/search');
  206.                 $('#engines1').fadeToggle('fast','circEaseOut');
  207.                 $('#wrapper1 input:text').css('background','#fff url(lib/bing-back.png) center right no-repeat');
  208.                 $('#wrapper1 input:hidden').detach();
  209.                 $('#wrapper1 input:first').attr('name','q');
  210.                 $('#wrapper1 input:text').focus();
  211.         });
  212.        
  213.         $('#yahoo1').click(function() {
  214.                 $('#wrapper1 form').attr('action','http://search.yahoo.com/bin/search');
  215.                 $('#engines1').fadeToggle('fast','circEaseOut');
  216.                 $('#wrapper1 input:text').css('background','#fff url(lib/yahoo-back.png) center right no-repeat');
  217.                 $('#wrapper1 input:hidden').detach();
  218.                 $('#wrapper1 input:first').attr('name','q');
  219.                 $('#wrapper1 input:text').focus();
  220.         });
  221.        
  222.         $('#wikipedia1').click(function() {
  223.                 $('#wrapper1 form').attr('action','http://www.wikipedia.org/search-redirect.php');
  224.                 $('#wrapper1 input:first').attr('name','search');
  225.                 $('<input type="hidden" name="language" value="en" />').appendTo('#wrapper1 form');
  226.                 $('#engines1').fadeToggle('fast','circEaseOut');
  227.                 $('#wrapper1 input:text').css('background','#fff url(lib/wikipedia-back.png) center right no-repeat');
  228.                 $('#wrapper1 input:text').focus();
  229.         });
  230.        
  231.         if(num>1){
  232.                 $('#search-engine2').click(function() {
  233.                         $('#engines2').fadeToggle('fast','circEaseOut');
  234.                         $('#wrapper2 input:text').css('background','#fff');
  235.                 });
  236.                
  237.                 $('#google2').click(function() {
  238.                         $('#wrapper2 form').attr('action','http://www.google.com/search');
  239.                         $('#engines2').fadeToggle('fast','circEaseOut');
  240.                         $('#wrapper2 input:text').css('background','#fff url(lib/google-back.png) center right no-repeat');
  241.                         $('#wrapper2 input:hidden').detach();
  242.                         $('#wrapper2 input:first').attr('name','q');
  243.                         $('#wrapper2 input:text').focus();
  244.                 });
  245.                
  246.                 $('#bing2').click(function() {
  247.                         $('#wrapper2 form').attr('action','http://www.bing.com/search');
  248.                         $('#engines2').fadeToggle('fast','circEaseOut');
  249.                         $('#wrapper2 input:text').css('background','#fff url(lib/bing-back.png) center right no-repeat');
  250.                         $('#wrapper2 input:hidden').detach();
  251.                         $('#wrapper2 input:first').attr('name','q');
  252.                         $('#wrapper2 input:text').focus();
  253.                 });
  254.                
  255.                 $('#yahoo2').click(function() {
  256.                         $('#wrapper2 form').attr('action','http://search.yahoo.com/bin/search');
  257.                         $('#engines2').fadeToggle('fast','circEaseOut');
  258.                         $('#wrapper2 input:text').css('background','#fff url(lib/yahoo-back.png) center right no-repeat');
  259.                         $('#wrapper2 input:hidden').detach();
  260.                         $('#wrapper2 input:first').attr('name','q');
  261.                         $('#wrapper2 input:text').focus();
  262.                 });
  263.                
  264.                 $('#wikipedia2').click(function() {
  265.                         $('#wrapper2 form').attr('action','http://www.wikipedia.org/search-redirect.php');
  266.                         $('#wrapper2 input:first').attr('name','search');
  267.                         $('<input type="hidden" name="language" value="en" />').appendTo('#wrapper2 form');
  268.                         $('#engines2').fadeToggle('fast','circEaseOut');
  269.                         $('#wrapper2 input:text').css('background','#fff url(lib/wikipedia-back.png) center right no-repeat');
  270.                         $('#wrapper2 input:text').focus();
  271.                 });
  272.         };
  273.        
  274.         if(num>2){
  275.                 $('#search-engine3').click(function() {
  276.                         $('#engines3').fadeToggle('fast','circEaseOut');
  277.                         $('#wrapper3 input:text').css('background','#fff');
  278.                 });
  279.                
  280.                 $('#google3').click(function() {
  281.                         $('#wrapper3 form').attr('action','http://www.google.com/search');
  282.                         $('#engines3').fadeToggle('fast','circEaseOut');
  283.                         $('#wrapper3 input:text').css('background','#fff url(lib/google-back.png) center right no-repeat');
  284.                         $('#wrapper3 input:hidden').detach();
  285.                         $('#wrapper3 input:first').attr('name','q');
  286.                         $('#wrapper3 input:text').focus();
  287.                 });
  288.                
  289.                 $('#bing3').click(function() {
  290.                         $('#wrapper3 form').attr('action','http://www.bing.com/search');
  291.                         $('#engines3').fadeToggle('fast','circEaseOut');
  292.                         $('#wrapper3 input:text').css('background','#fff url(lib/bing-back.png) center right no-repeat');
  293.                         $('#wrapper3 input:hidden').detach();
  294.                         $('#wrapper3 input:first').attr('name','q');
  295.                         $('#wrapper3 input:text').focus();
  296.                 });
  297.                
  298.                 $('#yahoo3').click(function() {
  299.                         $('#wrapper3 form').attr('action','http://search.yahoo.com/bin/search');
  300.                         $('#engines3').fadeToggle('fast','circEaseOut');
  301.                         $('#wrapper3 input:text').css('background','#fff url(lib/yahoo-back.png) center right no-repeat');
  302.                         $('#wrapper3 input:hidden').detach();
  303.                         $('#wrapper3 input:first').attr('name','q');
  304.                         $('#wrapper3 input:text').focus();
  305.                 });
  306.                 //哇,还有唯基...
  307.                 $('#wikipedia3').click(function() {
  308.                         $('#wrapper3 form').attr('action','http://www.wikipedia.org/search-redirect.php');
  309.                         $('input:first').attr('name','search');
  310.                         $('<input type="hidden" name="language" value="en" />').appendTo('#wrapper3 form');
  311.                         $('#engines3').fadeToggle('fast','circEaseOut');
  312.                         $('#wrapper3 input:text').css('background','#fff url(lib/wikipedia-back.png) center right no-repeat');
  313.                         $('#wrapper3 input:text').focus();
  314.                 });
  315.         };
  316. //控制隐藏
  317.         if(num<3){
  318.                 $('#name3').detach();
  319.                 $('#wrapper3').detach();
  320.                 $('#button2to3').detach();
  321.                 $('#button3to2').detach();
  322.         };

  323.         if(num<2){
  324.                 $('#name2').detach();
  325.                 $('#wrapper2').detach();
  326.                 $('#button1to2').detach();
  327.                 $('#button2to1').detach();
  328.         };

  329. });
复制代码
看了上面的代码,顿时五体投地。看来我的JS和CSS果然不是一般的烂.....
晚上蛋疼,没想到扒个代码也有这收获,嘿嘿。。学习到自己不足了。。{:1_1:}

文笔烂,凑合着看吧。。前几天有个求鱼C导航的,其实so easy。。

打看,看有多少个请求,之后copy all link到迅雷里。


评分

参与人数 2荣誉 +8 鱼币 +38 贡献 +3 收起 理由
小甲鱼 + 30 红包一个~
cathe + 8 + 8 + 3 赞一个!

查看全部评分

小甲鱼最新课程 -> https://ilovefishc.com
发表于 2012-11-25 09:00:41 | 显示全部楼层
字真多~~~~~
累吧!
小甲鱼最新课程 -> https://ilovefishc.com
发表于 2012-11-25 10:02:43 | 显示全部楼层
新手表示看不懂。鸭梨:L
小甲鱼最新课程 -> https://ilovefishc.com
发表于 2012-11-25 10:33:09 | 显示全部楼层
哥哥,这是什么东西!求教育!!!!

点评

鱼C导航的代码!  发表于 2012-11-25 15:52
小甲鱼最新课程 -> https://ilovefishc.com
发表于 2012-11-25 15:07:18 | 显示全部楼层
m貌似很牛比的样子。

点评

菜B一个,学几天就会了。  发表于 2012-11-25 15:52
小甲鱼最新课程 -> https://ilovefishc.com
发表于 2012-11-26 04:19:11 | 显示全部楼层
大家不要羡慕啦   每个人学习的路都不一样,它喜欢网页所以对网页方面比较清楚啊
小甲鱼最新课程 -> https://ilovefishc.com
发表于 2012-11-26 09:14:19 | 显示全部楼层

很多东西都不是很难,只要自己去攻克就好,我也想搞个自己的论坛玩玩,不知道该从哪里入手?求哥哥教育哈!

点评

搞自己论坛的话,去弄个空间和DZ的代码往上一架就行了。 自己写的话就比较恶心了,我和一个朋友,每天八个小时,写了一个月才写了一个公司内部的论坛。 而且我们公司人不多,多的话,要考虑性能的问题。  发表于 2012-11-26 22:44
小甲鱼最新课程 -> https://ilovefishc.com
发表于 2012-11-27 09:10:12 | 显示全部楼层
237236867 发表于 2012-11-26 09:14
很多东西都不是很难,只要自己去攻克就好,我也想搞个自己的论坛玩玩,不知道该从哪里入手?求哥哥教育哈 ...

谢谢哈,这东西没摸过就感觉很难入手!哥哥主攻哪个方面,求指导!
小甲鱼最新课程 -> https://ilovefishc.com
 楼主| 发表于 2012-11-27 09:37:39 | 显示全部楼层
从一门后台语言开始

之后数据库...

html css javascript ajax jquery(当然也可以自己手动写js不过能写疯你.)

至于服务器的话,不考虑调优,随便找一个就好了.
小甲鱼最新课程 -> https://ilovefishc.com
发表于 2013-2-10 04:22:12 | 显示全部楼层
这个没有猜错 的话    就是php 写的         我不会告诉你我真的不会 php       ;P
小甲鱼最新课程 -> https://ilovefishc.com
发表于 2013-2-10 08:07:07 | 显示全部楼层
牛逼啊。敬仰一下。啥也么看懂。:lol
小甲鱼最新课程 -> https://ilovefishc.com
发表于 2013-2-10 09:44:30 | 显示全部楼层
厉害啊~~~~
小甲鱼最新课程 -> https://ilovefishc.com
发表于 2013-2-11 19:14:06 | 显示全部楼层
姐姐~!!!!!
小甲鱼最新课程 -> https://ilovefishc.com
发表于 2013-2-12 12:12:56 | 显示全部楼层
强大 我也慢慢要学
小甲鱼最新课程 -> https://ilovefishc.com
发表于 2013-2-12 12:39:21 | 显示全部楼层
话说 我已经山寨过了,PS+代码修改且发布了、、在此跟帖 向鱼哥道歉哈~ 目前网站已经关闭
小甲鱼最新课程 -> https://ilovefishc.com
发表于 2013-2-12 13:19:58 | 显示全部楼层
我就是那个求导航的                              
小甲鱼最新课程 -> https://ilovefishc.com
发表于 2013-6-10 16:36:23 | 显示全部楼层
CRoot 发表于 2013-2-12 12:39
话说 我已经山寨过了,PS+代码修改且发布了、、在此跟帖 向鱼哥道歉哈~ 目前网站已经关闭

我也要扒下来
小甲鱼最新课程 -> https://ilovefishc.com
回复 支持 反对

使用道具 举报

发表于 2015-4-18 17:43:03 | 显示全部楼层
强烈支持楼主ing……
小甲鱼最新课程 -> https://ilovefishc.com
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|手机版|Archiver|鱼C工作室 ( 粤ICP备18085999号-1 | 粤公网安备 44051102000585号)

GMT+8, 2025-6-21 15:49

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表