Convert jquery. qqFace. js expressions into WeChat's QR code,

Source: Internet
Author: User

Convert jquery. qqFace. js emoticon into a QR code,

Jquery. qqFace. js usage

Reference

<script src="~/Content/qqFace/js/jquery.qqFace.js?v=3"></script><script src="~/Content/qqFace/js/jquery-browser.js"></script>

Html

<div style="width:50px;height:30px;margin-top:3px;text-align:center;line-height:30px;border-right:1px solid #dee5e7"></div><textarea class="input" id="saytext" name="saytext" style="display:none"></textarea>

Initialization

$ (Function () {$ ('. emotion '). qqFace ({id: 'facebox', assign: 'saytext', // assign path to the input box: '/Content/qqFace/arclist/' // path for storing emoticon images });});

The original jQuery. qqface. js has the following method:

function replace_em(str) {str = str.replace(/\</g, '<');str = str.replace(/\>/g, '>');str = str.replace(/\n/g, '<br/>');str = str.replace(/\[em_([0-9]*)\]/g, '');return str;}

Click on the emoticons to convert the emoticons into images and save them to $ ("# saytext"). I will modify it to display the emoticons where we need them.

// Modify the original jsvar str =$ ("# saytext "). val (). trim (); $ ("# show "). append (replace_em (str); $ ("# saytext "). val ('');

Convert an emoticon into a text verification code. Because the text cannot be replied to or added to an image when an automatic reply is made, I can find the corresponding verification code for the emoticon image based on the data on the Internet.

I combined the QR codes by myself in the order of the above expressions. Do some of them not find them? They are expressed in text directly. What they receive can also be converted into an emoticon.

Private string emoij = "/::);/::~; /: B;/: |;/: <;/: $;/: X;/: Z ;/::'(;/:: -|;/: @;/: P;/: D;/: O;/: :(;/:-B;/: Q ;/:: t;/:, @ P;/:, @-D;/: d;/:, @ o;/: g;/: | -);/: :!; /: L;/:>;/:, @;/:, @ f;/:-S ;/:?; /:, @ X;/:, @;/: 8 ;/:,@!; /: Xx;/: bye;/: wipe;/: dig;/: &-(;/: B-);/: <@;/: @> ;/: :-O;/:>-|;/: P-(;/: '|;/: X-);/: *;/: @ x ;/: 8 *; [hug]; [moon]; [Sun]; [bomb];/:!; /: Pd;/: pig;/: <W>;/: coffee;/: eat;/: heart; [strong]; [Weak]; [handshake]; [victory]; [hug]; [seduce]; [OK]; [NO];/: rose;/: fade;/: showlove; [skip]; [circled] "; var emoijarray = emoij. split (';'); int len = emoijarray. length; for (int I = 0; I <len; I ++) {string str = string. format (" ",'"', I + 1, '"'); if (xmlstr. contains (str) // check whether the text message sent Contains emoticon tags. If there are tags, replace them with the corresponding tokens. Maybe you can better replace them, I just cyclically search for matched replicas {xmlstr = xmlstr. replace (str, emoijarray [I]);}

This is where you will receive your facial expression.

Summary

The above section describes jquery. qqFace. I hope it will be helpful for you to convert JavaScript expressions into code. If you have any questions, please leave a message and I will reply to you in a timely manner. Thank you very much for your support for the help House website!

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.