Sina implemented flash, so the implementation method uses the flash callback function for operations, seeCode
// Jquery library required VaR Showcolorpicker = Function (Clickwhere, showwhere, initialcolor ){ VaR Colorflash = "<embed wmode = \" transparent \ "width = \" 251 \ "Height = \" 264 \ "type = \" application/X-Shockwave-Flash \ "src = \ "/colorpicker/colorpicker.swf \" id = \ "color_picker \" allowfullscreen = \ "True \" wmode = \ "Opaque \" allowScriptAccess = \ "always \" Quality = \ "High \" flashvars = \ "{vars} \"/>" ; // Callback is the function triggered after the color is selected. // Color indicates the starting color of the capture. // Who indicates the parameter passed to callback. Here I pass the clicked element (generally it can be the ID of the DOM element or other attributes that can be selected) Showwhere.html ( This . Colorflash. Replace ("{vars}", "Callback = colorcallback & color =" + initialcolor + "& WHO =" + clickwhere. ATTR ("class" )));} // Callback Function VaR Colorcallback = Function (Color, elems) {$ ( "." + Elems).css ("background-color", "#" +Color );};
In the Code Flash program colorpicker.swf "go here under the http://note.sdo.com/u/1534712737/c/rutKx ~ Jwgfcfnm00m000ws, which contains Weibo code.
Next, the mailbox prompt plug-in
( Function ($ ){ VaR Itemindex = 1 ; VaR Itemcount = 0 ; $. FN. jqp_emailnote = Function (Options ){ VaR Deafult ={Arrayemail :[ "Sina.com", "sina.com.cn", "163.com"," QQ.com "," sohu.com "], // Default mailbox Array Selfn: Null // Time triggered after selection }; VaR Ops = $. Extend (deafult, options); itemcount = 0 ; Itemindex = 1 ; VaR Initnote =Function (Loginctr, arrayemail ){ If ( Typeof (Loginctr) = "object "&& Typeof (Arrayemail) = "object" ){ VaR Offset = Loginctr. offset (); VaR Ulstr = "<div> <ul style = 'display: none; width: 198px; left:" + offset. left + "PX; top:" + (parseint (offset. top) + parseint (loginctr. height ())) + "PX 'id = 'sinanote' class = 'passcard '> <li class = 'note'> select the email type </LI> <li id = 'sinanote _ menuitem_title' style = 'color: RGB (0, 0, 0); background-color: RGB (232,244,252); '> </LI> </ul> </div>" ; If ($ ("# Sinanote") [0] = Null ) $ ( "Body" ). Append (ulstr ); VaR Note = $ ("# sinanote" ); Loginctr [ 0]. onkeyup =Function (E ){ VaR Currkey = 0, E = E | Event; currkey = E. keycode | E. Which | E. charcode; offset = Loginctr. offset (); $ ( "# Sinanote" 2.16.css ("Left", offset. Left + "PX" ); $ ( "# Sinanote" 2.16.css ("TOP", (parseint (offset. Top) + parseint (loginctr. Height () + "PX" ); If (Currkey! = 38 & currkey! = 40 & currkey! = 13) {Initliitem (loginctr, arrayemail); note. Show (); itemindex = 1 ; Itemcount = $ ("Ul. passcard> li"). Length-1 ;} Else {Note. Show (); VaR Lis = $ ("Ul. passcard> li" ) Switch (Currkey ){ Case 38: If (Itemindex = 1 ) {Itemindex = Lis. Length-1 ; Liselected ($ (LIS [itemindex]);} Else {Itemindex -- ; Liselected ($ (LIS [itemindex]);} Break ; Case 40 : If (Itemindex = Lis. Length-1 ) {Itemindex = 1 ; Liselected ($ (LIS [itemindex]);} Else {Itemindex ++ ; Liselected ($ (LIS [itemindex]);} Break ; Case 13 : $ ( This ). Val ($ (LIS [itemindex]). Text (); note. Hide (); itemcount = 0 ; Itemindex = 1 ; Ops. selfn (); // $ ("# Password_text"). Focus (); Break ;}};$ (Document). BIND ( "Click ", Function () {Note. Hide (); itemcount = 0 ; Itemindex = 1 ;}); $ ( "Ul. passcard"). Hover ( Function (E ){}, Function () {Liselected ($ ( "# Sinanote_menuitem_title" ); Itemcount = 0; Itemindex = 1 ;});}}; VaR Initliitem = Function (Loginctr, arrayemail ){ VaR Value = $. Trim (loginctr. Val (); $ ( "# Sinanote" 2.16.html ("<li class = 'note'> select the email type </LI> <li id = 'sinanote _ menuitem_title 'select = '1' style =' color: RGB (0, 0, 0); background-color: RGB (232,244,252); '> </LI>" ); $ ( "# Sinanote_menuitem_title" ). Text (value); $ ( "# Sinanote_menuitem_title"). ATTR ("title" , Value); bindlievent ($ ( "Ul. passcard Li: Last-child" ), Loginctr); $. Each (arrayemail, Function (I, V ){ If (Value. indexof ('@') <0 ){ If (Value. indexof ('@')> = 0 & value. Split ('@') [1]! = "" ){ If (Value. Split ('@') [1] = v | V. indexof (value. Split ('@') [1]) = 0){ VaR SD = "<li select = '0' Title = '" + value. split ('@') [0] + "@" + V + "'Id = 'sinanote _ menuitem _" + V + "'>" + value. split ('@') [0] + "@" + V + "</LI>" ; $ ( "# Sinanote" ). Append (SD );}} Else { If (Value. indexof ('@')> = 0 ) $ ( "# Sinanote "). append ("<li select = '0' Title = '" + value + V + "'id = 'sinanote _ menuitem _" + V + "'>" + value + V + "</LI>"); Else $ ( "# Sinanote "). append ("<li select = '0' Title = '" + value + "@" + V + "'id = 'sinanote _ menuitem _" + V + "'>" + value + "@" + V + "</LI>" );} Bindlievent ($ ( "Ul. passcard Li: Last-child" ), Loginctr );}});}; VaR Bindlievent = Function (Li, loginctr ){ If ( Typeof (LI) = "object" ) {Li. BIND ( "Click ", Function () {Loginctr. Val (Li. Text (); ops. selfn (); // $ ("# Password_text"). Focus (); }); Li. Hover ( Function (E) {liselected (LI );});}}; VaR Liselected = Function (LI ){ If ( Typeof (LI) = "object" ) {$ ( "Li [select = '1']" ).css ("color", "RGB (153,153,153 )" ); $ ( "Li [select = '1']" ).css ("background-color", "White" ); $ ( "Li [select = '1']"). ATTR ("select", "0" ); Li.css ( "Color", "RGB (0, 0, 0 )" ); Li.css ( "Background-color", "RGB (232,244,252 )" ); Li. ATTR ( "Select", "1" ) ;}}; Initnote ( This , Ops. arrayemail) ;}} (jquery );
CSS
# Sinanote { Position : Absolute ; Z-Index : 999999 ; Width : Auto ; Overflow : Hidden ; Padding : 0 ;Margin : 0 ; Border : 1px solid # ccc ; Background : # Fff ; Text-align : Left ;} # Sinanote Li { Font-size : 12px ; List-style : None ;Margin : 0 1px ; Height : 20px ; Padding : 0 5px ; Clear : Both ; Line-height : 20px ; Cursor : Pointer ; Color :#999 ;} # Sinanote Li. Note { Text-align : Left ; Color : #999 ;}
Continue to work after completion
Weibo source code release page http://www.cnblogs.com/baichidetiankong/archive/2012/04/17/weibo_source.html