html Z ^ 2 +刷

Z ^ 2 +刷

index.html
<!DOCTYPE html>
<meta charset="utf-8">
<style>
svg { font: 10px sans-serif; }
.brsh .extent { fill: steelblue; stroke: grey; stroke-width: 0.5px; fill-opacity: .125;}
.brsh .back   { fill: none; stroke: black; stroke-width: 1px;}
.mapd .line   { fill: none; stroke: black; stroke-width: 1px; }
.axis         { fill: none; stroke: black; }
</style>
<body>
<script src="http://d3js.org/d3.v3.min.js"></script>
<script>
    function Complex(re, im) { this.re  =   re; this.im  =   im; };
    Complex.prototype.clone = function(){ return new Complex(this.re,this.im); };
    Complex.prototype.add = function(z) { this.re += z.re; this.im += z.im; return this; };
    Complex.prototype.sub = function(z) { this.re -= z.re; this.im -= z.im; return this; };
    Complex.prototype.mul = function(z) 
    { 
        var tmp = this.re;
        this.re = this.re*z.re - this.im*z.im; 
        this.im =     tmp*z.im + this.im*z.re; 
        return this;
    };
                                                     
    Complex.prototype.div = function(z) 
    { 
        var tmp =  this.re, 
              n =     z.re*z.re +    z.im*z.im;
        this.re = (this.re*z.re + this.im*z.im)/n; 
        this.im = (   -tmp*z.im + this.im*z.re)/n; 
        return this;
    };
                                                     
 
 
    var width = 960, height = 500;
 
    var svg = d3.select("body")
                .append("svg")
                .attr("width",   width)
                .attr("height", height);

    var mapd = svg.append("g").attr("class","mapd");

    var brsh = svg.append("g").attr("class","brsh")
                              .attr("transform","translate("+width/2+")");
 
    var x = d3.scale.linear()
                    .range( [ 0, width/2])
                    .domain([    -1, 1]);
 
    var y = d3.scale.linear()
                    .range( [height, 0])
                    .domain([    -1, 1]);

    var xAxis = d3.svg.axis().scale(x).orient("bottom"),
        yAxis = d3.svg.axis().scale(y).orient("left");

    [mapd,brsh].map(function(g){
           g.append("g").attr("class","axis")
            .attr("transform","translate(0,"+height/2+")")
            .call(xAxis);

           g.append("g").attr("class","axis")
            .attr("transform","translate("+width/4+")")
            .call(yAxis); });
     
    var line = d3.svg.line()
                     .x(function(d) { return x(d.re); })
                     .y(function(d) { return y(d.im); });

    var brush = d3.svg.brush()
                      .x(x).y(y).on("brush", plot);    

    brsh.append("rect").attr("class","back")
                       .attr("width",width/2)
                       .attr("height",height);

    brsh.call(brush);


    function plot()
    { 
        if(brush.empty()) return;
        ext = brush.extent();

        var data = d3.range(ext[0][0],ext[1][0],(ext[1][0]-ext[0][0])/50.1).map(function(r){
            return d3.range(ext[0][1],ext[1][1],(ext[1][1]-ext[0][1])/50.1).map(function(i){
            return new Complex(r,i);})})

        data.forEach(function(d){d.forEach(function(z) {z.mul(z.clone())})});

        data = data.concat(d3.transpose(data));

        var paths = mapd.selectAll('.line').data(data);
        paths.enter().append('path').attr('class','line');
        paths.attr('d',line);
        paths.exit().remove();
    }

</script>
</body>

html 渐变水平线

渐变水平线

gradient-line.html
hr {
    border: none;
    border-top: 1px solid #eee;
    height: 5px;
    background: -webkit-radial-gradient(50% 0%, 50% 5px, #aaa 0%, white 100%);
}

html HTML5音频+语音到文本...一旦启用麦克风和语音识别,请说“facebook”,“hack”或“what is my name”

HTML5音频+语音到文本...一旦启用麦克风和语音识别,请说“facebook”,“hack”或“what is my name”

rtc_test_speech.html
<!DOCTYPE html>
<html>
<head>
  <title>HTML5 Web audio capture + Speech Recognition</title>
  <link href="http://www.smartjava.org/examples/webaudio-filters/css/bootstrap.css" rel="stylesheet"/>
</head>

<body>
  <div class="container">
    <h1 class="pagination-centered">HTML5 Web audio capture + Speech Recognition</h1><br />

    <div class="span1">
      <span>Microphone:</span>
    </div>

    <div class="span2">
      <div class="btn-toolbar" style="margin-top: -7px; margin-left: 10px">
        <div class="btn-group">
          <a class="btn btn-primary" id="mic-start" href="#"><i id="mic-start-icon" class="icon-play icon-white"></i></a>
          <a class="btn btn-primary disabled" id="mic-stop" href="#"><i id="mic-stop-icon" class="icon-stop icon-white"></i></a>
        </div>
      </div>
    </div>

    <div class="span1">
      <span>Recognition:</span>
    </div>

    <div class="span2">
      <div class="btn-toolbar" style="margin-top: -7px; margin-left: 10px">
        <div class="btn-group">
          <a class="btn btn-primary" id="recognition-start" href="#"><i id="recognition-start-icon" class="icon-play icon-white"></i></a>
          <a class="btn btn-primary disabled" id="recognition-stop" href="#"><i id="recognition-stop-icon" class="icon-stop icon-white"></i></a>
        </div>
      </div>
    </div>

  </div>

  <div class="container">
    <div class="row">
      <div class="span4">
        Spectrogram:
        <canvas id="spectrogram" width="300" height="256" style="display: block; background-color: black ;"></canvas>
      </div>

      <div class="span4">
        Waveform:
        <canvas id="waveform" width="300" height="256" style="display: block; background-color: black ;"></canvas>
      </div>

      <div class="span4">
        Wave:
        <canvas id="wave" width="530" height="100" style="display: block; background-color: white ;"></canvas>
      </div>
    </div>
  </div>

  <div class="container">
    <div id="results">
      <span class="final" id="final_span"></span> <span class="interim" id=
      "interim_span"></span>
    </div>
  </div>

<script src="http://www.smartjava.org/examples/webaudio-filters/js/jquery-1.8.2.js"></script>
<script src="http://www.smartjava.org/examples/webaudio-filters/js/jquery-ui-1.9.1.custom.js"></script>
<script src="http://www.smartjava.org/examples/webaudio-filters/js/bootstrap.min.js"></script>
<script src="http://www.smartjava.org/examples/webaudio-filters/js/chroma.js"></script>
<script>
///////////////////////////////////////////////////////////////////////////
// Web Audio API chr
///////////////////////////////////////////////////////////////////////////

// some globals
var context = new webkitAudioContext();
var audioBuffer;
var sourceNode;
var mediaStreamSource;
var osc = context.createOscillator();
var filter = context.createBiquadFilter();

filter.type = 3;
filter.frequency.value = 440;
filter.Q.value = 0;
filter.gain.value = 0;


// state variables
var micRunning = false;

// setup a javascript node
var javascriptNode = context.createJavaScriptNode(2048, 1, 1);

// connect to destination, else it isn't called
javascriptNode.connect(context.destination);
// when the javascript node is called
// we use information from the analyzer node
// to draw the volume
javascriptNode.onaudioprocess = function () {

    // get the average for the first channel
    var array = new Uint8Array(analyser.frequencyBinCount);
    analyser.getByteFrequencyData(array);

    if (micRunning) {
      drawSpectrogram(array);

      var array2 = new Uint8Array(analyser.frequencyBinCount);
      analyser.getByteTimeDomainData(array2);
      drawWave(array2);
      drawWaveform(array2);
    }

}

// setup a analyzer
var analyser = context.createAnalyser();
analyser.smoothingTimeConstant = 0;
analyser.fftSize = 512;

// create a buffer source node
filter.connect(analyser);
analyser.connect(javascriptNode);

// used for color distribution
var hot = new chroma.ColorScale({
    colors:['#000000', '#ff0000', '#ffff00', '#ffffff'],
    positions:[0, .25, .75, 1],
    mode:'rgb',
    limits:[0, 350]
});

$(document).ready(function () {
    setupHandlers();
});

function setupHandlers() {
  $("#mic-start").click(function () {
    navigator.webkitGetUserMedia({audio:true},function(stream) {
      mediaStreamSource = context.createMediaStreamSource(stream);
      mediaStreamSource.connect(filter);

      micRunning = true;
      $("#mic-start").addClass("disabled");
      $("#mic-stop").removeClass("disabled");
    });
  });

  $("#mic-stop").click(function () {
    mediaStreamSource.disconnect(filter);
    micRunning = false;

    $("#mic-stop").addClass("disabled");
    $("#mic-start").removeClass("disabled");
  });
}

// log if an error occurs
function onError(e) {
  console.log(e);
}

function drawWave(array) {
    var ctx = $("#wave").get()[0].getContext("2d");
    ctx.fillStyle = "#000000"
    ctx.clearRect(0, 0, 530, 100);

    for ( var i = 0; i < (array.length); i++ ){
      var value = array[i];
      // console.log("values: " + i + ", " + value);
      // ctx.fillRect(i+22,100-value,1,1);
      ctx.fillRect(i,190-value,1,1);
    }
};

function drawWaveform(array) {
  var ctx = $("#waveform").get()[0].getContext("2d");
  // create a temp canvas we use for copying
  var tempCanvas = document.createElement("canvas");
  tempCanvas.width = 460;
  tempCanvas.height = 300;
  var tempCtx = tempCanvas.getContext("2d");

  // copy the current canvas onto the temp canvas
  var canvas = document.getElementById("waveform");
  tempCtx.drawImage(canvas, 0, 0, 530, 100);

  var waveValues = [];
  var min = Math.min.apply(Math, array);
  var max = Math.max.apply(Math, array);
  for(min; min < max; min++) { waveValues.push(min); }

  for (var i = 0; i < waveValues.length; i++) {
    // draw each pixel with the specific color
    var value = waveValues[i];
    ctx.fillStyle = hot.getColor(value).hex();

    // draw the line at the right side of the canvas
    ctx.fillRect(1, 250-(value/1.5), 1, 1);
  }

  ctx.translate(1, 0);

  // set translate on the canvas
  // ctx.translate(-1, 0);

  // draw the copied image
  // ctx.drawImage(waveform, 0, 0, 300, 256, 0, 0, 300, 256);

  // reset the transformation matrix
  // ctx.setTransform(1, 0, 0, 1, 0, 0);
}


function drawSpectrogram(array) {
  var ctx = $("#spectrogram").get()[0].getContext("2d");
  // create a temp canvas we use for copying
  var tempCanvas = document.createElement("canvas");
  tempCanvas.width = 460;
  tempCanvas.height = 300;
  var tempCtx = tempCanvas.getContext("2d");

  // copy the current canvas onto the temp canvas
  var canvas = document.getElementById("spectrogram");
  tempCtx.drawImage(canvas, 0, 0, 530, 100);

  // iterate over the elements from the array
  for (var i = 0; i < array.length; i++) {
    // draw each pixel with the specific color
    var value = array[i];
    ctx.fillStyle = hot.getColor(value).hex();

    // draw the line at the right side of the canvas
    ctx.fillRect(300 - 1, 256 - i, 1, 1);
  }

  // set translate on the canvas
  ctx.translate(-1, 0);
  // draw the copied image
  ctx.drawImage(spectrogram, 0, 0, 300, 256, 0, 0, 300, 256);

  // reset the transformation matrix
  ctx.setTransform(1, 0, 0, 1, 0, 0);
}

/////////////////////////////////////////////////////////////
// Voice Rec
/////////////////////////////////////////////////////////////

var create_email = false;
var final_transcript = '';
var recognizing = false;
var ignore_onend;
var start_timestamp;
var recognition = new webkitSpeechRecognition();
recognition.continuous = true;
recognition.interimResults = true;

recognition.onstart = function() {
  recognizing = true;
  console.log("on start");
};

recognition.onerror = function(event) {
  if (event.error == 'no-speech') {
    console.log("event error no-speech");
    ignore_onend = true;
  }
  if (event.error == 'audio-capture') {
    console.log("event error audio-capture");
    ignore_onend = true;
  }
  if (event.error == 'not-allowed') {
    if (event.timeStamp - start_timestamp < 100) {
      console.log("event error not allowed");
    } else {
      console.log("event error permission denied");
    }
    ignore_onend = true;
  }
};

recognition.onend = function() {
  recognizing = false;
  if (ignore_onend) {
    return;
  }

  if (!final_transcript) {
    console.log("info start");
    return;
  }

  if (window.getSelection) {
    window.getSelection().removeAllRanges();
    var range = document.createRange();
    range.selectNode(document.getElementById('final_span'));
    window.getSelection().addRange(range);
  }
};

recognition.onresult = function(event) {
  var interim_transcript = '';
  var last_command = '';

  if (typeof(event.results) == 'undefined') {
    recognition.onend = null;
    recognition.stop();
    return;
  }
  for (var i = event.resultIndex; i < event.results.length; ++i) {
    if (event.results[i].isFinal) {
      final_transcript += event.results[i][0].transcript;
    } else {
      interim_transcript += event.results[i][0].transcript;
      last_command = event.results[i][0].transcript;
    }
  }

  final_transcript = capitalize(final_transcript);
  final_span.innerHTML = linebreak(final_transcript);
  interim_span.innerHTML = linebreak(interim_transcript);

  console.log("final: ", final_transcript);
  console.log("interim: ", interim_transcript);
  console.log("last command: ", last_command);

  if (final_transcript || interim_transcript) {
    if(last_command.match(/facebook/i)) {
      alert('You just said Facebook. Dude. No.');
    }
    if(last_command.match(/hack/i)) {
      alert("Woah! Hackathon!.");
    }
    if(last_command.match(/what is my name/i)) {
      var names = ["Wil Hung", "Philip McKrack","Jack Mehoff","Phil Atio","Hugh Jareckson","Hugh Janus","Ijaz Fhated","Dawn Keibals","Dixie Normous","Emersom Biggins","Craven Moorhead","Anita Lay","Mike Hunt","Aster Rhoids","Willie Hardigan","Suq Madiq"];
      alert(names[Math.floor(Math.random()*11)]);
    }
  }
};


var two_line = /\n\n/g;
var one_line = /\n/g;
function linebreak(s) {
  return s.replace(two_line, '<p></p>').replace(one_line, '<br>');
}

var first_char = /\S/;
function capitalize(s) {
  return s.replace(first_char, function(m) { return m.toUpperCase(); });
}

$('#recognition-start').on('click', function() {
  if (recognizing) {
    recognition.stop();
    return;
  }
  final_transcript = '';
  recognition.lang = 6;
  recognition.start();
  ignore_onend = false;
  start_timestamp = event.timeStamp;
  $("#recognition-start").addClass("disabled");
  $("#recognition-stop").removeClass("disabled");
});

</script>
</body>
</html>

html session_link

session_link

session_link.html
<a href="{{event.active_session_link}}">Click Here</a>

html 动画Joukowski地图

动画Joukowski地图

index.html
<!DOCTYPE html>
<meta charset="utf-8">
<style>
.ani .line { fill: none; stroke: steelblue; stroke-width: 1.5px; }
.grd .line { fill: none; stroke: black;     stroke-width: 0.5px; }
</style>
<body>
<script src="http://d3js.org/d3.v3.min.js"></script>
<script>
    function Complex(re, im) { this.re  =   re; this.im  =   im; };
    Complex.prototype.clone = function(){ return new Complex(this.re,this.im); };
    Complex.prototype.add = function(z) { this.re += z.re; this.im += z.im; return this; };
    Complex.prototype.sub = function(z) { this.re -= z.re; this.im -= z.im; return this; };
    Complex.prototype.mul = function(z) 
    { 
        var tmp = this.re;
        this.re = this.re*z.re - this.im*z.im; 
        this.im =     tmp*z.im + this.im*z.re; 
        return this;
    };
                                                     
    Complex.prototype.div = function(z) 
    { 
        var tmp =  this.re, 
              n =     z.re*z.re +    z.im*z.im;
        this.re = (this.re*z.re + this.im*z.im)/n; 
        this.im = (   -tmp*z.im + this.im*z.re)/n; 
        return this;
    };
                                                     
 
 
    var width = 960, height = 500;
 
    var svg = d3.select("body")
                .append("svg")
                .attr("width",   width)
                .attr("height", height);

    var grd = svg.append("g").attr("class","grd");
    var ani = svg.append("g").attr("class","ani");
 
    var x = d3.scale.linear()
                    .range( [ 0, width])
                    .domain([    -5, 5]);
 
    var y = d3.scale.linear()
                    .range( [height, 0])
                    .domain([    -5, 5]);
 
    var line = d3.svg.line()
                     .x(function(d) { return x(d.re); })
                     .y(function(d) { return y(d.im); });


    function ProduceData(roff,poff)
    {
        var data = d3.range(0.87+roff,roff,-0.02).map(function(r){
                   return d3.range(-Math.PI/4+poff,7*Math.PI/4,Math.PI/50).map(function(p){
                          return new Complex(r*Math.cos(p)-0.2,r*Math.sin(p)+0.2);})})
        data.forEach(function(d){d.forEach(function(z) {z.add((new Complex(1,0)).div(z));})});
        return data;
    }
 
    var data = ProduceData(0,0.01); 
    var save = data[0];
    data = d3.transpose(data);
    save.push(save[0]);
    data.unshift(save);
    
    var paths = grd.selectAll('path').data(data);
    paths.enter().append('path').attr('class','line');
    paths.attr('d',line)
    
    function plot(offset)
    { 
        var data = ProduceData(offset,0); 
        var paths = ani.selectAll('path').data(data);
        paths.enter().append('path').attr('class','line');
        paths.attr('d',function(d) { return line(d) + 'Z'; })
             .attr('stroke-opacity', function(d,i){ if(i<20) return i/20; else return 1.; });
        paths.exit().remove();
    }
    var off = 0;
    d3.timer(function() { plot(off); off -= 0.001; if(off<0) off=0.019;});
        
 
</script>
</body>

html 基于CSS的Fizz Buzz

基于CSS的Fizz Buzz

CSS-fizzbuzz.html
<style>
li:nth-child(3n+3):before {
    content : "fizz";
}
li:nth-child(5n+5):after {
    content : "buzz";
}
</style>
<ol>
    <li></li>
    <li></li>
    <li></li>
    <li></li>
    <li></li>
    <li></li>
    <li></li>
    <li></li>
    <li></li>
    <li></li>
    <li></li>
    <li></li>
    <li></li>
    <li></li>
    <li></li>
    <li></li>
    <li></li>
    <li></li>
    <li></li>
    <li></li>
    <li></li>
    <li></li>
    <li></li>
    <li></li>
    <li></li>
    <li></li>
    <li></li>
    <li></li>
    <li></li>
    <li></li>
    <li></li>
    <li></li>
    <li></li>
    <li></li>
    <li></li>
    <li></li>
    <li></li>
    <li></li>
    <li></li>
    <li></li>
    <li></li>
    <li></li>
    <li></li>
    <li></li>
    <li></li>
    <li></li>
    <li></li>
    <li></li>
    <li></li>
    <li></li>
    <li></li>
    <li></li>
    <li></li>
    <li></li>
    <li></li>
    <li></li>
    <li></li>
    <li></li>
    <li></li>
    <li></li>
    <li></li>
    <li></li>
    <li></li>
    <li></li>
    <li></li>
    <li></li>
    <li></li>
    <li></li>
    <li></li>
    <li></li>
    <li></li>
    <li></li>
    <li></li>
    <li></li>
    <li></li>
    <li></li>
    <li></li>
    <li></li>
    <li></li>
    <li></li>
    <li></li>
    <li></li>
    <li></li>
    <li></li>
    <li></li>
    <li></li>
    <li></li>
    <li></li>
    <li></li>
    <li></li>
    <li></li>
    <li></li>
    <li></li>
    <li></li>
    <li></li>
    <li></li>
    <li></li>
    <li></li>
    <li></li>
    <li></li>
</ol>

html Joukowsky在d3.js中变换

Joukowsky在d3.js中变换

index.html
<!DOCTYPE html>
<meta charset="utf-8">
<style>
.line { fill: none; stroke: steelblue; stroke-width: 1.5px; }
</style>
<body>
<script src="http://d3js.org/d3.v3.min.js"></script>
<script>
    function Complex(re, im) { this.re  =   re; this.im  =   im; };
    Complex.prototype.clone = function(){ return new Complex(this.re,this.im); };
    Complex.prototype.add = function(z) { this.re += z.re; this.im += z.im; return this; };
    Complex.prototype.sub = function(z) { this.re -= z.re; this.im -= z.im; return this; };
    Complex.prototype.mul = function(z) 
    { 
        var tmp = this.re;
        this.re = this.re*z.re - this.im*z.im; 
        this.im =     tmp*z.im + this.im*z.re; 
        return this;
    };
                                                     
    Complex.prototype.div = function(z) 
    { 
        var tmp =  this.re, 
              n =     z.re*z.re +    z.im*z.im;
        this.re = (this.re*z.re + this.im*z.im)/n; 
        this.im = (   -tmp*z.im + this.im*z.re)/n; 
        return this;
    };
                                                     


    var width = 960, height = 500;

    var svg = d3.select("body")
                .append("svg")
                .attr("width",   width)
                .attr("height", height);

    var x = d3.scale.linear()
                    .range( [ 0, width])
                    .domain([-1,     3]);

    var y = d3.scale.linear()
                    .range( [height, 0])
                    .domain([    -2, 2]);

    var xAxis = d3.svg.axis().scale(x).orient("bottom");
    var yAxis = d3.svg.axis().scale(y).orient("left");

    var line = d3.svg.line()
                     .x(function(d) { return x(d.re); })
                     .y(function(d) { return y(d.im); });

    var data = d3.range(0,1,0.02).map(function(r){
               return d3.range(-Math.PI,Math.PI,Math.PI/50).map(function(p){
                      return new Complex(r*Math.cos(p)-0.2,r*Math.sin(p)+0.2);})})

    data.forEach(function(d){d.forEach(function(z) {z.add((new Complex(1,0)).div(z));})});

    svg.selectAll('path').data(data).enter().append('path').attr('class','line').attr('d',line);

</script>
</body>

html 原理证明:z ^ 2与d3js共形映射

原理证明:z ^ 2与d3js共形映射

index.html
<!DOCTYPE html>
<meta charset="utf-8">
<style>
.line { fill: none; stroke: steelblue; stroke-width: 1.5px; }
</style>
<body>
<script src="http://d3js.org/d3.v3.min.js"></script>
<script>
    function Complex(re, im) { this.re  =   re; this.im  =   im; };
    Complex.prototype.clone = function() { return new Complex(this.re,this.im); };
    Complex.prototype.add = function(z) { this.re += z.re; this.im += z.im; };
    Complex.prototype.sub = function(z) { this.re -= z.re; this.im -= z.im; };
    Complex.prototype.mul = function(z) 
    { 
        var tmp = this.re;
        this.re = this.re*z.re - this.im*z.im; 
        this.im =     tmp*z.im + this.im*z.re; 
    };
                                                     
    Complex.prototype.div = function(z) 
    { 
        var tmp =  this.re, 
              n =     z.re*z.re +    z.im*z.im;
        this.re = (this.re*z.re + this.im*z.im)/n; 
        this.im = (   -tmp*z.im + this.im*z.re)/n; 
    };
                                                     


    var width = 960, height = 500;

    var svg = d3.select("body")
                .append("svg")
                .attr("width",   width)
                .attr("height", height);

    var x = d3.scale.linear()
                    .range( [ 0, width])
                    .domain([-1,     1]);

    var y = d3.scale.linear()
                    .range( [height, 0])
                    .domain([    -1, 1]);

    var line = d3.svg.line()
                     .x(function(d) { return x(d.re); })
                     .y(function(d) { return y(d.im); });

    var data = d3.range(0,1,0.1).map(function(r){return d3.range(-1,1,0.01).map(function(i){return new Complex(r,i);})})

    data.forEach(function(d){d.forEach(function(z) {z.mul(z.clone());})});

    svg.selectAll('path').data(data).enter().append('path')
                                            .attr('class','line')
                                            .attr('d',line);

</script>
</body>

html CSS:省略号

CSS:省略号

css.ellipsis.html
<!doctype html>
<html lang="en">
<head>
  <meta charset="UTF-8">
	<title>Document</title>
	<style>
		.listWithCat{
			font-size: 14px;
			width: 120px;
		}
		.listWithCat li{
			height: 25px;
			line-height: 25px;
			overflow: hidden;
			white-space: nowrap;
			width: 100%;                  /* IE6 需要定义宽度 */           

			-o-text-overflow: ellipsis;    /* Opera */
			text-overflow:    ellipsis;    /* IE, Safari (WebKit) */
		}
		.listWithCat a{
			text-decoration: none;
		}
		.listWithCat span{
			padding: 0 10px;
		}
		.listWithCat .cat{
			color: #fd7b03;
		}
		.listWithCat .cat:hover{
			color: #5a5a5a;
		}
	</style>
</head>
<body>
	<ul class="listWithCat">
		<li><a href="#" class="cat">分类</a><span>|</span><a href="#">网站的标题网站的标题网站的标题网站的标题网站的标题网站的标题网站的标题网站的标题网站的标题网站的标题</a></li>
		<li><a href="#" class="cat">分类</a><span>|</span><a href="#">网站的标题网站的标题网站的标题网站的标题网站的标题网站的标题网站的标题网站的标题网站的标题网站的标题</a></li>
		<li><a href="#" class="cat">分类</a><span>|</span><a href="#">网站的标题网站的标题网站的标题网站的标题网站的标题网站的标题网站的标题网站的标题网站的标题网站的标题</a></li>
		<li><a href="#" class="cat">分类</a><span>|</span><a href="#">网站的标题网站的标题网站的标题网站的标题网站的标题网站的标题网站的标题网站的标题网站的标题网站的标题</a></li>
	</ul>
</body>
</html>

html 异步推文按钮

异步推文按钮

tweet_button.html
<a href="http://twitter.com/share" class="twitter-share-button" data-count="vertical">Tweet</a>

<!-- Put this JS at the bottom of the page -->
<script id="deferedjs" type="text/javascript">
var b = document.createElement('script');
b.type = 'text/javascript';
b.src = ('http://platform.twitter.com/widgets.js');
var a=document.getElementById("deferedjs");
a.parentNode.insertBefore(b,a);
</script>