0.9.1 • Published 6 years ago

qr-code-and-vcard v0.9.1

Weekly downloads
101
License
MIT
Repository
github
Last release
6 years ago

QR code and vCard generations

This module allows you to generate qr code and create vCard contact. Module support cyrillic (utf-8)

Download

  $ bower install qr-code-and-vcard --save;
  $ git clone https://github.com/konstantin-nizhinskiy/qr-code-and-vcard.git;

Loader supports

* AMD
* CommonJS

Methods

MethodArgumentsinfo
CreateQroptionsQrCreate qr code
CreateVCardoptionsVCardCreate vCard code
CreateVCardQroptionsVCard,optionsQrCreate qr code from vCard

optionsQr

keystypedefaultinfo
typeNumbernumber15Type number (1 ~ 40)
typeElementstringcreateImgType element create QR ('createImg','createSvg','createTable')
errorCorrectionLevelstringLError correction level ('L', 'M', 'Q', 'H')
datastringEvent error load json translation
cellSizenumber2Size qr

optionsVCard

https://en.wikipedia.org/wiki/VCard

keystypeinfo
versionstringThe version of the vCard specification. In versions 3.0 and 4.0, this must come right after the BEGIN property.
formattedNamestringCustomize contact name
firstNamestringFirst name contact
middleNamestringMiddle name contact
lastNamestringLast name contact
namePrefixstringAdd prefix name
nameSuffixstringAdd suffix name
nicknamestringOne or more descriptive/familiar names for the object represented by this vCard.
genderstringDefines the person's gender.
birthdaystringDate of birth of the individual associated with the vCard.
anniversarystringDefines the person's anniversary.
emailarray,stringHOME The address for electronic mail communication with the vCard object.
workEmailarray,stringWORK The address for electronic mail communication with the vCard object.
otherEmailarray,stringOTHER The address for electronic mail communication with the vCard object.
logoobjectAn image or graphic of the logo of the organization that is associated with the individual to which the vCard belongs.
logo.urlstringUrl to img
logo.mediaTypestringType
logo.base64booleanFormat img
photoobjectAn image or photograph of the individual associated with the vCard.
photo.urlstringUrl to img
photo.mediaTypestringType
photo.base64booleanFormat img
cellPhonearray,stringPhone cellular
pagerPhonearray,stringPhone to send messages to a pager
homePhonearray,stringPhone home
workPhonearray,stringPhone work
homeFaxarray,stringFax home
workFaxarray,stringFax work
otherPhonearray,stringOther phone
homeAddressobjectHome address
homeAddress.labelstringRepresents the actual text that should be put on the mailing label when delivering a physical package to the person/object associated with the vCard (related to the ADR property).
homeAddress.streetstringHome street
homeAddress.citystringHome city
homeAddress.stateProvincestringHome stateProvince
homeAddress.postalCodestringHome postalCode
homeAddress.countryRegionstringHome countryRegion
workAddressobjectHome workAddress
workAddress.labelstringRepresents the actual text that should be put on the mailing label when delivering a physical package to the person/object associated with the vCard (related to the ADR property).
workAddress.streetstringWork street
workAddress.citystringWork city
workAddress.stateProvincestringWork stateProvince
workAddress.postalCodestringWork postalCode
workAddress.countryRegionstringWork countryRegion
titlestringSpecifies the job title, functional position or function of the individual associated with the vCard object within an organization.
rolestringThe role, occupation, or business category of the vCard object within an organization.
organizationstringThe name and optionally the unit(s) of the organization associated with the vCard object. This property is based on the X.520 Organization Name attribute and the X.520 Organization Unit attribute.
urlstringA URL pointing to a website that represents the person in some way.
workUrlstringWork URL pointing to a website that represents the person in some way.
notestringSpecifies supplemental information or a comment that is associated with the vCard.
socialUrlsobjectSocial contact
socialUrls.facebookstringFacebook
socialUrls.linkedInstringLinkedIn
socialUrls.twitterstringTwitter
socialUrls.flickrstringFlickr
socialUrls.skypestringSkype
socialUrls.(custom)stringOther social
sourcestringBy default, if this property is not grouped with other properties it specifies the pronunciation of the FN property of the vCard object
revstringA timestamp for the last time the vCard was updated.

Example

<!-- ... -->
    <script src="../dist/QrCode.js" type="application/javascript"></script>
    <div id="qr1"></div>
    <div id="qr2"></div>
    <div id="qr_vcard"></div>
    <pre id="vcard"></pre>
    <script>
        var  testCard= {
            version: '3.0',
            lastName: 'Нижинский',
            middleName: 'D',
            firstName: 'Костя',
            nameSuffix: 'JR',
            namePrefix: 'MR',
            nickname: 'Test User',
            gender: 'M',
            organization: 'ACME Corporation',
            workPhone: '312-555-1212444',
            homePhone: '312-555-1313333',
            cellPhone: '312-555-1414111',
            pagerPhone: '312-555-1515222',
            homeFax: '312-555-1616',
            workFax: '312-555-1717',
            birthday: "20140112",
            anniversary: "20140112",
            title: 'Crash Test Dummy',
            role: 'Crash Testing',
            email: 'john.doe@testmail',
            workEmail: 'john.doe@workmail',
            url: 'http://johndoe',
            workUrl: 'http://acemecompany/johndoe',
            homeAddress: {
                label: 'Home Address',
                street: '123 Main Street',
                city: 'Chicago',
                stateProvince: 'IL',
                postalCode: '12345',
                countryRegion: 'United States of America'
            },
    
            workAddress: {
                label: 'Work Address',
                street: '123 Corporate Loop\nSuite 500',
                city: 'Los Angeles',
                stateProvince: 'CA',
                postalCode: '54321',
                countryRegion: 'California Republic'
            },
    
            source: 'http://sourceurl',
            note: 'dddddd',
            socialUrls: {
                facebook: 'johndoe',
                linkedIn: 'johndoe',
                twitter: 'johndoe',
                flickr: 'johndoe',
                skype:"test_skype",
                custom: 'johndoe'
            }
        };
    
    
    

        document.getElementById('qr_vcard').innerHTML = qrCode.createVCardQr(testCard, {typeNumber: 30, cellSize: 5});
        
        document.getElementById('qr1').innerHTML = qrCode.createQr({typeElement:"createSvg", data:"text QR", typeNumber: 5, cellSize: 5});
        document.getElementById('qr2').innerHTML = qrCode.createQr("test QR 2");
        
        document.getElementById('vcard').innerHTML = qrCode.createVCard(testCard)
    
    
    </script>


<!-- ... -->