Best JavaScript code snippet using protractor
serveccda.js
Source:serveccda.js  
1/**2 * @package   OpenEMR CCDAServer3 * @link      http://www.open-emr.org4 *5 * @author    Jerry Padgett <sjpadgett@gmail.com>6 * @copyright Copyright (c) 2016-2020 Jerry Padgett <sjpadgett@gmail.com>7 * @license   https://github.com/openemr/openemr/blob/master/LICENSE GNU General Public License 38 */9"use strict";10var net = require('net');11var to_json = require('xmljson').to_json;12var bbg = require('oe-blue-button-generate');13//var bbm = require('blue-button-model'); //for use set global-not needed here14//var fs = require('fs');15//var bb = require('blue-button');16var fs = require('fs');17var server = net.createServer();18var conn = ''; // make our connection scope global to script19var oidFacility = "";20var all = "";21var npiProvider = "";22var npiFacility = "";23// some useful routines for populating template sections24function validate(toValidate, ref, retObj) {25    for (var p in ref) {26        if (typeof ref[p].dataType === "undefined") {27            retObj[p] = {};28            if (!toValidate[p]) toValidate[p] = {};29            validate(toValidate[p], ref[p], retObj[p]);30        } else {31            if (typeof toValidate === "undefined") toValidate = {};32            var trimmed = trim(toValidate[p]);33            retObj[p] = typeEnforcer(ref[p].dataType, trimmed);34        }35    }36    return retObj;37}38function typeEnforcer(type, val) {39    var validVal;40    switch (type) {41        case "boolean":42            if (typeof val === "string") {43                validVal = val.toLowerCase() === "true";44            } else {45                validVal = !!val;46            }47            break;48        case "string":49            if ((val === null) || (val === "undefined") || (typeof val === "undefined")) {50                validVal = '';51            } else if (typeof val == "object") {52                validVal = '';53            } else {54                validVal = trim(String(val));55            }56            break;57        case "array":58            if (typeof val === 'undefined' || val === null) {59                validVal = [];60            } else if (Array.isArray(val)) {61                validVal = [];62                val.forEach(function (v) {63                    validVal.push(trim(v));64                });65            } else {66                validVal = [trim(val)];67            }68            break;69        case "integer":70            var asInt = parseInt(val, 10);71            if (isNaN(asInt)) asInt = 0;72            validVal = asInt;73            break;74        case "number":75            var asNum = parseFloat(val);76            if (isNaN(asNum)) asNum = 0;77            validVal = asNum;78            break;79    }80    return validVal;81}82function trim(s) {83    if (typeof s === 'string') return s.trim();84    return s;85}86function safeId(s) {87    return trim(s).toLowerCase().replace(/[^a-zA-Z0-9]+/g, '-').replace(/\-+$/, '');88}89function fDate(str) {90    str = String(str); // at least ensure string so cast it...91    if (Number(str) === 0) {92        return (new Date()).toISOString().slice(0,10).replace(/-/g,"");93    }94    if (str.length === 8 || (str.length === 14 && (1 * str.substring(12, 14)) === 0)) {95        return [str.slice(0, 4), str.slice(4, 6), str.slice(6, 8)].join('-')96    } else if (str.length === 10 && (1 * str.substring(0, 2)) <= 12) {97        // case mm/dd/yyyy or mm-dd-yyyy98        return [str.slice(6, 10), str.slice(0, 2), str.slice(3, 5)].join('-')99    } else if (str.length === 14 && (1 * str.substring(12, 14)) > 0) {100        // maybe a real time so parse101    }102    return str;103}104function getPrecision(str) {105    str = String(str);106    let pflg = "day";107    if (Number(str) === 0) {108        return "day";109    }110    if (str.length > 8) {111        pflg = "minute";112    }113    if (str.length > 12) {114        pflg = "second";115    }116    return pflg;117}118function templateDate(date, precision) {119    return [{'date': fDate(date), 'precision': precision}]120}121function cleanCode(code) {122    return code.replace(/[.#]/, "");123}124function isOne(who) {125    try {126        if (who !== null && typeof who === 'object') {127            return who.hasOwnProperty('extension') || who.hasOwnProperty('id') ? 1 : Object.keys(who).length;128        }129    }130    catch (e) {131        return false;132    }133    return 0;134}135function headReplace(content) {136    var r = '<ClinicalDocument xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:hl7-org:v3" xmlns:voc="urn:hl7-org:v3/voc" xmlns:sdtc="urn:hl7-org:sdtc">\n';137    r += content.substr(content.search(/<realmCode/i));138    return r;139}140// Data model for Blue Button141function populateDemographic(pd, g) {142    let guardian = [{143        "relation": g.relation,144        "addresses": [{145            "street_lines": [g.address],146            "city": g.city,147            "state": g.state,148            "zip": g.postalCode,149            "country": g.country,150            "use": "primary home"151        }],152        "names": [{153            "last": g.display_name, //@todo parse first/last154            "first": g.display_name155        }],156        "phone": [{157            "number": g.telecom,158            "type": "primary home"159        }]160    }];161    return {162        "name": {163            "middle": [pd.mname],164            "last": pd.lname,165            "first": pd.fname166        },167        "dob": {168            "point": {169                "date": fDate(pd.dob),170                "precision": "day"171            }172        },173        "gender": pd.gender.toUpperCase(),174        "identifiers": [{175            "identifier": oidFacility,176            "extension": "PT-" + pd.id177        }],178        "marital_status": pd.status.toUpperCase() || "U",179        "addresses": [{180            "street_lines": [pd.street],181            "city": pd.city,182            "state": pd.state,183            "zip": pd.postalCode,184            "country": pd.country,185            "use": "primary home"186        }],187        "phone": [{188            "number": pd.phone_home,189            "type": "primary home"190        }],191        "race": pd.race,192        "ethnicity": pd.ethnicity || "U",193        "languages": [{194            "language": pd.language,195            "preferred": true,196            "mode": "Expressed spoken",197            "proficiency": "Good"198        }],199        "religion": pd.religion.toUpperCase() || "",200        /*"birthplace":'', {201            "city": "",202            "state": "",203            "zip": "",204            "country": ""205        },*/206        "attributed_provider": {207            "identity": [208                {209                    "root": "2.16.840.1.113883.4.6",210                    "extension": npiFacility || "UNK"211                }212            ],213            "phone": [{214                "number": all.encounter_provider.facility_phone || "",215            }],216            "name": [217                {218                    "full": all.encounter_provider.facility_name || ""219                }220            ]221        },222        "guardians": g.display_name ? guardian : ''223    }224}225function populateProviders() {226    return {227        "providers": [228            {229                "identity": [230                    {231                        "root": "2.16.840.1.113883.4.6",232                        "extension": all.primary_care_provider.provider[0].npi || "UNK"233                    }234                ],235                "type": [236                    {237                        "name": all.primary_care_provider.provider[0].physician_type || "Not Avail",238                        "code": all.primary_care_provider.provider[0].physician_type_code || "",239                        "code_system_name": "Provider Codes"240                    }241                ],242                "name": [243                    {244                        "last": all.primary_care_provider.provider[0].lname || "",245                        "first": all.primary_care_provider.provider[0].fname || ""246                    }247                ],248                "address": [249                    {250                        "street_lines": [251                            all.encounter_provider.facility_street252                        ],253                        "city": all.encounter_provider.facility_city,254                        "state": all.encounter_provider.facility_state,255                        "zip": all.encounter_provider.facility_postal_code,256                        "country": all.encounter_provider.facility_country_code257                    }258                ],259                "phone": [260                    {261                        "value": {262                            "number": all.encounter_provider.facility_phone || "",263                        }264                    }],265                "organization": [266                    {267                        "identifiers": [268                            {269                                "identifier": "2.16.840.1.113883.19.5.9999.1393" //@todo need facility oid270                            }271                        ],272                        "name": [273                            all.encounter_provider.facility_name274                        ],275                        "address": [276                            {277                                "street_lines": [278                                    all.encounter_provider.facility_street279                                ],280                                "city": all.encounter_provider.facility_city,281                                "state": all.encounter_provider.facility_state,282                                "zip": all.encounter_provider.facility_postal_code,283                                "country": all.encounter_provider.facility_country_code284                            }285                        ],286                        "phone": [287                            {288                                "number": all.encounter_provider.facility_phone,289                                "type": "primary work"290                            }291                        ]292                    }293                ]294            }295        ]296    }297}298function populateMedication(pd) {299    pd.status = 'Completed'; //@todo invoke prescribed300    return {301        "date_time": {302            "low": {303                "date": fDate(pd.start_date),304                "precision": "day"305            },306            /*"high": {307                "date": pd.end_date ? fDate(pd.end_date) : "",308                "precision": "day"309            }*/310        },311        "identifiers": [{312            "identifier": pd.sha_extension,313            "extension": pd.extension || "UNK"314        }],315        "status": pd.status,316        "sig": pd.direction,317        "product": {318            "identifiers": [{319                "identifier": "2a620155-9d11-439e-92b3-5d9815ff4ee8",320                "extension": "UNK"321            }],322            "unencoded_name": pd.drug,323            "product": {324                "name": pd.drug,325                "code": pd.rxnorm,326                /*"translations": [{327                    "name": pd.drug,328                    "code": pd.rxnorm,329                    "code_system_name": "RXNORM"330                }],*/331                "code_system_name": "RXNORM"332            },333            //"manufacturer": ""334        },335        "supply": {336            "date_time": {337                "low": {338                    "date": fDate(pd.start_date),339                    "precision": "day"340                }341            },342            "repeatNumber": "0",343            "quantity": "0",344            "author": {345                "date_time": {346                    "point": {347                        "date": fDate(pd.start_date),348                        "precision": getPrecision(fDate(pd.start_date))349                    }350                },351                "identifiers": [{352                    "identifier": "2.16.840.1.113883.4.6",353                    "extension": pd.npi || "UNK"354                }],355                "name": {356                    "prefix": pd.title,357                    "last": pd.lname,358                    "first": pd.fname359                }360            },361            "instructions": {362                "code": {363                    "name": "instruction",364                    "code": "409073007",365                    "code_system_name": "SNOMED CT"366                },367                "free_text": pd.instructions || "None Available"368            },369        },370        "administration": {371            "route": {372                "name": pd.route || "",373                "code": pd.route_code || "",374                "code_system_name": "Medication Route FDA"375            },376            "form": {377                "name": pd.form,378                "code": pd.form_code,379                "code_system_name": "Medication Route FDA"380            },381            "dose": {382                "value": parseFloat(pd.size),383                "unit": pd.unit,384            },385            /*"rate": {386                "value": parseFloat(pd.dosage),387                "unit": ""388            },*/389            "interval": {390                "period": {391                    "value": parseFloat(pd.dosage),392                    "unit": pd.interval393                },394                "frequency": true395            }396        },397        "performer": {398            "identifiers": [{399                "identifier": "2.16.840.1.113883.4.6",400                "extension": pd.npi || "UNK"401            }],402            "organization": [{403                "identifiers": [{404                    "identifier": pd.sha_extension,405                    "extension": pd.extension || "UNK"406                }],407                "name": [pd.performer_name]408            }]409        },410        "drug_vehicle": {411            "name": pd.form,412            "code": pd.form_code,413            "code_system_name": "RXNORM"414        },415        /*"precondition": {416            "code": {417                "code": "ASSERTION",418                "code_system_name": "ActCode"419            },420            "value": {421                "name": "none",422                "code": "none",423                "code_system_name": "SNOMED CT"424            }425        },426        "indication": {427            "identifiers": [{428                "identifier": "db734647-fc99-424c-a864-7e3cda82e703",429                "extension": "45665"430            }],431            "code": {432                "name": "Finding",433                "code": "404684003",434                "code_system_name": "SNOMED CT"435            },436            "date_time": {437                "low": {438                    "date": fDate(pd.start_date),439                    "precision": "day"440                }441            },442            "value": {443                "name": pd.indications,444                "code": pd.indications_code,445                "code_system_name": "SNOMED CT"446            }447        },*/448        /*"dispense": {449            "identifiers": [{450                "identifier": "1.2.3.4.56789.1",451                "extension": "cb734647-fc99-424c-a864-7e3cda82e704"452            }],453            "performer": {454                "identifiers": [{455                    "identifier": "2.16.840.1.113883.19.5.9999.456",456                    "extension": "2981823"457                }],458                "address": [{459                    "street_lines": [pd.address],460                    "city": pd.city,461                    "state": pd.state,462                    "zip": pd.zip,463                    "country": "US"464                }],465                "organization": [{466                    "identifiers": [{467                        "identifier": "2.16.840.1.113883.19.5.9999.1393"468                    }],469                    "name": [pd.performer_name]470                }]471            },472            "product": {473                "identifiers": [{474                    "identifier": "2a620155-9d11-439e-92b3-5d9815ff4ee8"475                }],476                "unencoded_name": pd.drug,477                "product": {478                    "name": pd.drug,479                    "code": pd.rxnorm,480                    "translations": [{481                        "name": pd.drug,482                        "code": pd.rxnorm,483                        "code_system_name": "RXNORM"484                    }],485                    "code_system_name": "RXNORM"486                },487                "manufacturer": ""488            }489        }*/490    };491}492function populateEncounter(pd) {493    return {494        "encounter": {495            "name": pd.visit_category ? pd.visit_category : 'UNK',496            "code": "185347001",497            "code_system": "2.16.840.1.113883.6.96",498            "code_system_name": "SNOMED CT",499            "translations": [{500                "name": "Ambulatory",501                "code": "AMB",502                "code_system_name": "ActCode"503            }]504        },505        "identifiers": [{506            "identifier": pd.sha_extension,507            "extension": pd.extension508        }],509        "date_time": {510            "point": {511                "date": fDate(pd.date),512                "precision": "second" //getPrecision(fDate(pd.date_formatted))513            }514        },515        "performers": [{516            "identifiers": [{517                "identifier": "2.16.840.1.113883.4.6",518                "extension": pd.npi || "UNK"519            }],520            "code": [{521                "name": pd.physician_type,522                "code": pd.physician_type_code,523                "code_system_name": "SNOMED CT"524            }],525            "name": [526                {527                    "last": pd.lname || "UNK",528                    "first": pd.fname || "UNK"529                }530            ],531            "phone": [532                {533                    "number": pd.work_phone,534                    "type": "work place"535                }536            ]537        }],538        "locations": [{539            "name": pd.location,540            "location_type": {541                "name": pd.location_details,542                "code": "1160-1",543                "code_system_name": "HealthcareServiceLocation"544            },545            "address": [{546                "street_lines": [pd.facility_address],547                "city": pd.facility_city,548                "state": pd.facility_state,549                "zip": pd.facility_zip,550                "country": pd.facility_country551            }]552        }],553        "findings": [{554            "identifiers": [{555                "identifier": pd.sha_extension,556                "extension": pd.extension557            }],558            "value": {559                "name": pd.encounter_reason,560                "code": "",561                "code_system_name": "SNOMED CT"562            },563            "date_time": {564                "low": {565                    "date": fDate(pd.date),566                    "precision": "day"567                }568            }569        }]570    };571}572function populateAllergy(pd) {573    return {574        "identifiers": [{575            "identifier": "36e3e930-7b14-11db-9fe1-0800200c9a66",576            "extension": pd.id || "UNK"577        }],578        "date_time": {579            "point": {580                "date": fDate(pd.startdate),581                "precision": "day"582            }583        },584        "observation": {585            "identifiers": [{586                "identifier": "4adc1020-7b14-11db-9fe1-0800200c9a66",587                "extension": pd.extension || "UNK"588            }],589            "allergen": {590                "name": pd.title,591                "code": pd.rxnorm_code === 0 ? "" : pd.rxnorm_code,592                "code_system_name": "RXNORM"593            },594            "intolerance": {595                "name": "Propensity to adverse reactions to drug",596                "code": pd.snomed_code || "420134006",597                "code_system_name": "SNOMED CT"598            },599            "date_time": {600                "low": {601                    "date": fDate(pd.startdate),602                    "precision": "day"603                }604            },605            "status": {606                "name": pd.allergy_status,607                "code": pd.status_code === 0 ? "" : pd.status_code,608                "code_system_name": "SNOMED CT"609            },610            "reactions": [{611                "identifiers": [{612                    "identifier": "4adc1020-7b14-11db-9fe1-0800200c9a64"613                }],614                "date_time": {615                    "low": templateDate(pd.startdate, "day"),616                    "high": templateDate(pd.enddate, "day")617                },618                "reaction": {619                    "name": pd.reaction_text,620                    "code": pd.reaction_code === 0 ? "" : pd.reaction_code,621                    "code_system_name": "SNOMED CT"622                },623                "severity": {624                    "code": {625                        "name": pd.outcome,626                        "code": pd.outcome_code === 0 ? "" : pd.outcome_code,627                        "code_system_name": "SNOMED CT"628                    },629                    /*"interpretation": {630                        "name": "",631                        "code": "",632                        "code_system_name": "Observation Interpretation"633                    }*/634                }635            }],636            "severity": {637                "code": {638                    "name": pd.outcome,639                    "code": pd.outcome_code === 0 ? "" : pd.outcome_code,640                    "code_system_name": "SNOMED CT"641                },642                /*"interpretation": {643                    "name": "UNK",644                    "code": "",645                    "code_system_name": "Observation Interpretation"646                }*/647            }648        }649    };650}651function populateProblem(pd) {652    return {653        "date_time": {654            "low": {655                "date": fDate(pd.start_date_table),656                "precision": "day"657            },658            /*"high": {659                "date": fDate(pd.end_date),660                "precision": "day"661            }*/662        },663        "identifiers": [{664            "identifier": pd.sha_extension,665            "extension": pd.extension || "UNK"666        }],667        "problem": {668            "code": {669                "name": trim(pd.title),670                "code": cleanCode(pd.code),671                "code_system": "2.16.840.1.113883.6.90",672                "code_system_name": "ICD10"673            },674            "date_time": {675                "low": {676                    "date": fDate(pd.start_date),677                    "precision": "day"678                },679                /*"high": {680                    "date": fDate(pd.end_date),681                    "precision": getPrecision()682                }*/683            }684        },685        "performer": [686            {687                "identifiers": [688                    {689                        "identifier": "2.16.840.1.113883.4.6",690                        "extension": all.primary_care_provider.provider[0].npi || "UNK"691                    }692                ],693                "name": [694                    {695                        "last": all.primary_care_provider.provider[0].lname || "",696                        "first": all.primary_care_provider.provider[0].fname || ""697                    }698                ]699            }],700        "onset_age": pd.age,701        "onset_age_unit": "Year",702        "status": {703            "name": pd.status_table,704            "date_time": {705                "low": {706                    "date": fDate(pd.start_date),707                    "precision": "day"708                },709                /*"high": {710                    "date": fDate(pd.end_date),711                    "precision": getPrecision()712                }*/713            }714        },715        "patient_status": pd.observation,716        "source_list_identifiers": [{717            "identifier": pd.sha_extension,718            "extension": pd.extension || "UNK"719        }]720    };721}722function populateProcedure(pd) {723    return {724        "procedure": {725            "name": pd.description,726            "code": pd.code,727            "code_system": "2.16.840.1.113883.6.12",728            "code_system_name": "CPT4"729        },730        "identifiers": [{731            "identifier": "d68b7e32-7810-4f5b-9cc2-acd54b0fd85d",732            "extension": pd.extension733        }],734        "status": "completed",735        "date_time": {736            "point": {737                "date": fDate(pd.date),738                "precision": "day"739            }740        },741        /*"body_sites": [{742            "name": "",743            "code": "",744            "code_system_name": ""745        }],746        "specimen": {747            "identifiers": [{748                "identifier": "c2ee9ee9-ae31-4628-a919-fec1cbb58683"749            }],750            "code": {751                "name": "",752                "code": "",753                "code_system_name": "SNOMED CT"754            }755        },*/756        "performers": [{757            "identifiers": [{758                "identifier": "2.16.840.1.113883.4.6",759                "extension": pd.npi || "UNK"760            }],761            "address": [{762                "street_lines": [pd.address],763                "city": pd.city,764                "state": pd.state,765                "zip": pd.zip,766                "country": ""767            }],768            "phone": [{769                "number": pd.work_phone,770                "type": "work place"771            }],772            "organization": [{773                "identifiers": [{774                    "identifier": pd.facility_sha_extension,775                    "extension": pd.facility_extension776                }],777                "name": [pd.facility_name],778                "address": [{779                    "street_lines": [pd.facility_address],780                    "city": pd.facility_city,781                    "state": pd.facility_state,782                    "zip": pd.facility_zip,783                    "country": pd.facility_country784                }],785                "phone": [{786                    "number": pd.facility_phone,787                    "type": "work place"788                }]789            }]790        }],791        "procedure_type": "procedure"792    };793}794function populateResult(pd) {795    let icode = pd.subtest.abnormal_flag;796    switch (pd.subtest.abnormal_flag.toUpperCase()) {797        case "NO":798            icode = "Normal";799            break;800        case "YES":801            icode = "Abnormal";802            break;803        case "":804            icode = "UNK";805            break;806    }807    return {808        "identifiers": [{809            "identifier": pd.subtest.root,810            "extension": pd.subtest.extension811        }],812        "result": {813            "name": pd.title,814            "code": pd.subtest.result_code || "",815            "code_system_name": "LOINC"816        },817        "date_time": {818            "point": {819                "date": fDate(pd.date_ordered),820                "precision": "day"821            }822        },823        "status": pd.order_status,824        "reference_range": {825            "range": pd.subtest.range //OpenEMR doesn't have high/low so show range as text.826        },827        /*"reference_range": {828            "low": pd.subtest.range,829            "high": pd.subtest.range,830            "unit": pd.subtest.unit831        },*/832        "interpretations": [icode],833        "value": parseFloat(pd.subtest.result_value) || pd.subtest.result_value || "",834        "unit": pd.subtest.unit835    };836}837function getResultSet(results) {838    if (!results) return '';839    let tResult = results.result[0] || results.result;840    var resultSet = {841        "identifiers": [{842            "identifier": tResult.root,843            "extension": tResult.extension844        }],845        "author": [846            {847                "date_time": {848                    "point": {849                        "date": fDate(tResult.date_ordered),850                        "precision": getPrecision(fDate(tResult.date_ordered))851                    }852                },853                "identifiers": [854                    {855                        "identifier": "2.16.840.1.113883.4.6",856                        "extension": all.primary_care_provider.provider.npi || "UNK"857                    }858                ],859                "name": [860                    {861                        "last": all.primary_care_provider.provider.lname || "",862                        "first": all.primary_care_provider.provider.fname || ""863                    }864                ]865            }],866        "result_set": {867            "name": tResult.test_name,868            "code": tResult.test_code,869            "code_system_name": "LOINC"870        }871    };872    var rs = [];873    var many = [];874    var theone = {};875    var count = 0;876    many.results = [];877    try {878        count = isOne(results.result);879    } catch (e) {880        count = 0;881    }882    if (count > 1) {883        for (let i in results.result) {884            theone[i] = populateResult(results.result[i]);885            many.results.push(theone[i]);886        }887    } else if (count !== 0) {888        theone = populateResult(results.result);889        many.results.push(theone);890    }891    rs.results = Object.assign(resultSet);892    rs.results.results = Object.assign(many.results);893    return rs;894}895function getPlanOfCare(pd) {896    return {897        "plan": {898            "name": pd.code_text,899            "code": pd.code,900            "code_system_name": "SNOMED CT"901        },902        "identifiers": [{903            "identifier": "9a6d1bac-17d3-4195-89a4-1121bc809b4a"904        }],905        "date_time": {906            "center": {907                "date": fDate(pd.date),908                "precision": "day"909            }910        },911        "type": "observation",912        "status": {913            "code": pd.status914        },915        "subType": pd.description916    };917}918function populateVital(pd) {919    return [{920        "identifiers": [{921            "identifier": "2.16.840.1.113883.3.140.1.0.6.10.14.1",922            "extension": pd.extension_bps923        }],924        "vital": {925            "name": "Blood Pressure Systolic",926            "code": "8480-6",927            "code_system_name": "LOINC"928        },929        "status": "completed",930        "date_time": {931            "point": {932                "date": fDate(pd.effectivetime),933                "precision": getPrecision(fDate(pd.effectivetime))934            }935        },936        "value": parseFloat(pd.bps),937        "unit": "mm[Hg]"938    }, {939        "identifiers": [{940            "identifier": "2.16.840.1.113883.3.140.1.0.6.10.14.1",941            "extension": pd.extension_bpd942        }],943        "vital": {944            "name": "Blood Pressure Diastolic",945            "code": "8462-4",946            "code_system_name": "LOINC"947        },948        "status": "completed",949        "date_time": {950            "point": {951                "date": fDate(pd.effectivetime),952                "precision": getPrecision(fDate(pd.effectivetime))953            }954        },955        "interpretations": ["Normal"],956        "value": parseFloat(pd.bpd),957        "unit": "mm[Hg]"958    }, {959        "identifiers": [{960            "identifier": "2.16.840.1.113883.3.140.1.0.6.10.14.1",961            "extension": pd.extension_pulse962        }],963        "vital": {964            "name": "Heart Rate",965            "code": "8867-4",966            "code_system_name": "LOINC"967        },968        "status": "completed",969        "date_time": {970            "point": {971                "date": fDate(pd.effectivetime),972                "precision": getPrecision(fDate(pd.effectivetime))973            }974        },975        "interpretations": ["Normal"],976        "value": parseFloat(pd.pulse),977        "unit": "/min"978    }, {979        "identifiers": [{980            "identifier": "2.16.840.1.113883.3.140.1.0.6.10.14.1",981            "extension": pd.extension_breath982        }],983        "vital": {984            "name": "Respiratory Rate",985            "code": "9279-1",986            "code_system_name": "LOINC"987        },988        "status": "completed",989        "date_time": {990            "point": {991                "date": fDate(pd.effectivetime),992                "precision": getPrecision(fDate(pd.effectivetime))993            }994        },995        "interpretations": ["Normal"],996        "value": parseFloat(pd.breath),997        "unit": "/min"998    }, {999        "identifiers": [{1000            "identifier": "2.16.840.1.113883.3.140.1.0.6.10.14.1",1001            "extension": pd.extension_temperature1002        }],1003        "vital": {1004            "name": "Body Temperature",1005            "code": "8310-5",1006            "code_system_name": "LOINC"1007        },1008        "status": "completed",1009        "date_time": {1010            "point": {1011                "date": fDate(pd.effectivetime),1012                "precision": getPrecision(fDate(pd.effectivetime))1013            }1014        },1015        "interpretations": ["Normal"],1016        "value": parseFloat(pd.temperature),1017        "unit": "degF"1018    }, {1019        "identifiers": [{1020            "identifier": "2.16.840.1.113883.3.140.1.0.6.10.14.1",1021            "extension": pd.extension_height1022        }],1023        "vital": {1024            "name": "Height",1025            "code": "8302-2",1026            "code_system_name": "LOINC"1027        },1028        "status": "completed",1029        "date_time": {1030            "point": {1031                "date": fDate(pd.effectivetime),1032                "precision": getPrecision(fDate(pd.effectivetime))1033            }1034        },1035        "interpretations": ["Normal"],1036        "value": parseFloat(pd.height),1037        "unit": pd.unit_height1038    }, {1039        "identifiers": [{1040            "identifier": "2.16.840.1.113883.3.140.1.0.6.10.14.1",1041            "extension": pd.extension_weight1042        }],1043        "vital": {1044            "name": "Weight Measured",1045            "code": "3141-9",1046            "code_system_name": "LOINC"1047        },1048        "status": "completed",1049        "date_time": {1050            "point": {1051                "date": fDate(pd.effectivetime),1052                "precision": getPrecision(fDate(pd.effectivetime))1053            }1054        },1055        "interpretations": ["Normal"],1056        "value": parseFloat(pd.weight),1057        "unit": pd.unit_weight1058    }, {1059        "identifiers": [{1060            "identifier": "2.16.840.1.113883.3.140.1.0.6.10.14.1",1061            "extension": pd.extension_BMI1062        }],1063        "vital": {1064            "name": "BMI (Body Mass Index)",1065            "code": "39156-5",1066            "code_system_name": "LOINC"1067        },1068        "status": "completed",1069        "date_time": {1070            "point": {1071                "date": fDate(pd.effectivetime),1072                "precision": getPrecision(fDate(pd.effectivetime))1073            }1074        },1075        "interpretations": ["Normal"],1076        "value": parseFloat(pd.BMI),1077        "unit": "kg/m2"1078    }];1079}1080function populateSocialHistory(pd) {1081    return {1082        "date_time": {1083            "low": templateDate(pd.date, "day")1084            //"high": templateDate(pd.date, "day")1085        },1086        "identifiers": [{1087            "identifier": pd.sha_extension,1088            "extension": pd.extension1089        }],1090        "code": {1091            "name": pd.element1092        },1093        "value": pd.description1094    };1095}1096function populateImmunization(pd) {1097    return {1098        "date_time": {1099            "point": {1100                "date": fDate(pd.administered_on),1101                "precision": "month"1102            }1103        },1104        "identifiers": [{1105            "identifier": "e6f1ba43-c0ed-4b9b-9f12-f435d8ad8f92",1106            "extension": pd.extension || "UNK"1107        }],1108        "status": "complete",1109        "product": {1110            "product": {1111                "name": pd.code_text,1112                "code": pd.cvx_code,1113                "code_system_name": "CVX"1114                /*"translations": [{1115                    "name": "",1116                    "code": "",1117                    "code_system_name": "CVX"1118                }]*/1119            },1120            "lot_number": "1",1121            "manufacturer": "UNK"1122        },1123        "administration": {1124            "route": {1125                "name": pd.route_of_administration,1126                "code": pd.route_code,1127                "code_system_name": "Medication Route FDA"1128            },1129            "dose": {1130                "value": 50,1131                "unit": "mcg"1132            }1133        },1134        "performer": {1135            "identifiers": [{1136                "identifier": "2.16.840.1.113883.4.6",1137                "extension": npiProvider1138            }],1139            "name": [{1140                "last": pd.lname,1141                "first": pd.fname1142            }],1143            "address": [{1144                "street_lines": [pd.address],1145                "city": pd.city,1146                "state": pd.state,1147                "zip": pd.zip,1148                "country": "US"1149            }],1150            "organization": [{1151                "identifiers": [{1152                    "identifier": "2.16.840.1.113883.4.6",1153                    "extension": npiFacility1154                }],1155                "name": [pd.facility_name]1156            }]1157        },1158        "instructions": {1159            "code": {1160                "name": "immunization education",1161                "code": "171044003",1162                "code_system_name": "SNOMED CT"1163            },1164            "free_text": "Needs Attention for more data."1165        }1166    };1167}1168function populatePayer(pd) {1169    return {1170        "identifiers": [{1171            "identifier": "1fe2cdd0-7aad-11db-9fe1-0800200c9a66"1172        }],1173        "policy": {1174            "identifiers": [{1175                "identifier": "3e676a50-7aac-11db-9fe1-0800200c9a66"1176            }],1177            "code": {1178                "code": "SELF",1179                "code_system_name": "HL7 RoleCode"1180            },1181            "insurance": {1182                "code": {1183                    "code": "PAYOR",1184                    "code_system_name": "HL7 RoleCode"1185                },1186                "performer": {1187                    "identifiers": [{1188                        "identifier": "2.16.840.1.113883.19"1189                    }],1190                    "address": [{1191                        "street_lines": ["123 Insurance Road"],1192                        "city": "Blue Bell",1193                        "state": "MA",1194                        "zip": "02368",1195                        "country": "US",1196                        "use": "work place"1197                    }],1198                    "phone": [{1199                        "number": "(781)555-1515",1200                        "type": "work place"1201                    }],1202                    "organization": [{1203                        "name": ["Good Health Insurance"],1204                        "address": [{1205                            "street_lines": ["123 Insurance Road"],1206                            "city": "Blue Bell",1207                            "state": "MA",1208                            "zip": "02368",1209                            "country": "US",1210                            "use": "work place"1211                        }],1212                        "phone": [{1213                            "number": "(781)555-1515",1214                            "type": "work place"1215                        }]1216                    }],1217                    "code": [{1218                        "code": "PAYOR",1219                        "code_system_name": "HL7 RoleCode"1220                    }]1221                }1222            }1223        },1224        "guarantor": {1225            "code": {1226                "code": "GUAR",1227                "code_system_name": "HL7 Role"1228            },1229            "identifiers": [{1230                "identifier": "329fcdf0-7ab3-11db-9fe1-0800200c9a66"1231            }],1232            "name": [{1233                "prefix": "Mr.",1234                "middle": ["Frankie"],1235                "last": "Everyman",1236                "first": "Adam"1237            }],1238            "address": [{1239                "street_lines": ["17 Daws Rd."],1240                "city": "Blue Bell",1241                "state": "MA",1242                "zip": "02368",1243                "country": "US",1244                "use": "primary home"1245            }],1246            "phone": [{1247                "number": "(781)555-1212",1248                "type": "primary home"1249            }]1250        },1251        "participant": {1252            "code": {1253                "name": "Self",1254                "code": "SELF",1255                "code_system_name": "HL7 Role"1256            },1257            "performer": {1258                "identifiers": [{1259                    "identifier": "14d4a520-7aae-11db-9fe1-0800200c9a66",1260                    "extension": "1138345"1261                }],1262                "address": [{1263                    "street_lines": ["17 Daws Rd."],1264                    "city": "Blue Bell",1265                    "state": "MA",1266                    "zip": "02368",1267                    "country": "US",1268                    "use": "primary home"1269                }],1270                "code": [{1271                    "name": "Self",1272                    "code": "SELF",1273                    "code_system_name": "HL7 Role"1274                }]1275            },1276            "name": [{1277                "prefix": "Mr.",1278                "middle": ["A."],1279                "last": "Everyman",1280                "first": "Frank"1281            }]1282        },1283        "policy_holder": {1284            "performer": {1285                "identifiers": [{1286                    "identifier": "2.16.840.1.113883.19",1287                    "extension": "1138345"1288                }],1289                "address": [{1290                    "street_lines": ["17 Daws Rd."],1291                    "city": "Blue Bell",1292                    "state": "MA",1293                    "zip": "02368",1294                    "country": "US",1295                    "use": "primary home"1296                }]1297            }1298        },1299        "authorization": {1300            "identifiers": [{1301                "identifier": "f4dce790-8328-11db-9fe1-0800200c9a66"1302            }],1303            "procedure": {1304                "code": {1305                    "name": "Colonoscopy",1306                    "code": "73761001",1307                    "code_system_name": "SNOMED CT"1308                }1309            }1310        }1311    };1312}1313function populateHeader(pd) {1314    var head = {1315        "identifiers": [1316            {1317                "identifier": oidFacility,1318                "extension": "TT988"1319            }1320        ],1321        "code": {1322            "name": "Continuity of Care Document",1323            "code": "34133-9",1324            "code_system_name": "LOINC"1325        },1326        "template": [1327            "2.16.840.1.113883.10.20.22.1.1",1328            "2.16.840.1.113883.10.20.22.1.2"1329        ],1330        "title": "Clinical Health Summary",1331        "date_time": {1332            "point": {1333                "date": fDate(pd.created_time) || "",1334                "precision": getPrecision(fDate(pd.created_time))1335            }1336        },1337        "author": {1338            "author": [1339                {1340                    "identifiers": [1341                        {1342                            "identifier": "2.16.840.1.113883.4.6",1343                            "extension": pd.author.npi || "UNK"1344                        }1345                    ],1346                    "name": [1347                        {1348                            "last": pd.author.lname,1349                            "first": pd.author.fname1350                        }1351                    ],1352                    "address": [1353                        {1354                            "street_lines": [1355                                pd.author.streetAddressLine1356                            ],1357                            "city": pd.author.city,1358                            "state": pd.author.state,1359                            "zip": pd.author.postalCode,1360                            "country": pd.author.country1361                        }1362                    ],1363                    "phone": [1364                        {1365                            "number": pd.author.telecom,1366                            "use": "work place"1367                        }1368                    ],1369                    "code": [1370                        {1371                            "name": "UNK",1372                            "code": ""1373                        }1374                    ],1375                    "organization": [1376                        {1377                            "identity": [1378                                {1379                                    "root": "2.16.840.1.113883.4.6",1380                                    "extension": npiFacility || "UNK"1381                                }1382                            ],1383                            "name": [1384                                pd.encounter_provider.facility_name1385                            ],1386                            "address": [1387                                {1388                                    "street_lines": [1389                                        pd.encounter_provider.facility_street1390                                    ],1391                                    "city": pd.encounter_provider.facility_city,1392                                    "state": pd.encounter_provider.facility_state,1393                                    "zip": pd.encounter_provider.facility_postal_code,1394                                    "country": pd.encounter_provider.facility_country_code1395                                }1396                            ],1397                            "phone": [1398                                {1399                                    "number": pd.encounter_provider.facility_phone,1400                                    "type": "work primary"1401                                }1402                            ]1403                        }1404                    ]1405                }1406            ]1407        },1408        "custodian": {1409            "identity": [1410                {1411                    "root": "2.16.840.1.113883.4.6",1412                    "extension": npiFacility || "UNK"1413                }1414            ],1415            "name": [1416                pd.encounter_provider.facility_name1417            ],1418            "address": [1419                {1420                    "street_lines": [1421                        pd.encounter_provider.facility_street1422                    ],1423                    "city": pd.encounter_provider.facility_city,1424                    "state": pd.encounter_provider.facility_state,1425                    "zip": pd.encounter_provider.facility_postal_code,1426                    "country": pd.encounter_provider.facility_country_code1427                }1428            ],1429            "phone": [1430                {1431                    "number": pd.encounter_provider.facility_phone,1432                    "type": "work primary"1433                }1434            ]1435        },1436        /*"data_enterer": {1437            "identifiers": [1438                {1439                    "identifier": "2.16.840.1.113883.4.6",1440                    "extension": "999999943252"1441                }1442            ],1443            "name": [1444                {1445                    "last": pd.data_enterer.lname,1446                    "first": pd.data_enterer.fname1447                }1448            ],1449            "address": [1450                {1451                    "street_lines": [1452                        pd.data_enterer.streetAddressLine1453                    ],1454                    "city": pd.data_enterer.city,1455                    "state": pd.data_enterer.state,1456                    "zip": pd.data_enterer.postalCode,1457                    "country": pd.data_enterer.country1458                }1459            ],1460            "phone": [1461                {1462                    "number": pd.data_enterer.telecom,1463                    "type": "work place"1464                }1465            ]1466        },1467        "informant": {1468            "identifiers": [1469                {1470                    "identifier": "2.16.840.1.113883.19.5",1471                    "extension": "KP00017"1472                }1473            ],1474            "name": [1475                {1476                    "last": pd.informer.lname || "",1477                    "first": pd.informer.fname || ""1478                }1479            ],1480            "address": [1481                {1482                    "street_lines": [1483                        pd.informer.streetAddressLine || ""1484                    ],1485                    "city": pd.informer.city,1486                    "state": pd.informer.state,1487                    "zip": pd.informer.postalCode,1488                    "country": pd.informer.country1489                }1490            ],1491            "phone": [1492                {1493                    "number": pd.informer.telecom || "",1494                    "type": "work place"1495                }1496            ]1497        },*/1498        "service_event": { // @todo maybe move this to attributed or write z-schema template1499            "code": {1500                "name": "",1501                "code": "",1502                "code_system_name": "SNOMED CT"1503            },1504            "date_time": {1505                "low": {1506                    "date": "",1507                    "precision": getPrecision()1508                },1509                "high": {1510                    "date": pd.created_time,1511                    "precision": getPrecision()1512                }1513            },1514            "performer": [1515                {1516                    "performer": [1517                        {1518                            "identifiers": [1519                                {1520                                    "identifier": "2.16.840.1.113883.4.6",1521                                    "extension": "PseudoMD-1"1522                                }1523                            ],1524                            "name": [1525                                {1526                                    "last": pd.information_recipient.lname,1527                                    "first": pd.information_recipient.fname1528                                }1529                            ],1530                            "address": [1531                                {1532                                    "street_lines": [1533                                        pd.information_recipient.streetAddressLine1534                                    ],1535                                    "city": pd.information_recipient.city,1536                                    "state": pd.information_recipient.state,1537                                    "zip": pd.information_recipient.postalCode,1538                                    "country": pd.information_recipient.country1539                                }1540                            ],1541                            "phone": [1542                                {1543                                    "number": pd.information_recipient.telecom,1544                                    "type": "work place"1545                                }1546                            ],1547                            "organization": [1548                                {1549                                    "identifiers": [1550                                        {1551                                            "identifier": "2.16.840.1.113883.19.5.9999.1393"1552                                        }1553                                    ],1554                                    "name": [1555                                        pd.encounter_provider.facility_name1556                                    ],1557                                    "address": [1558                                        {1559                                            "street_lines": [1560                                                pd.encounter_provider.facility_street1561                                            ],1562                                            "city": pd.encounter_provider.facility_city,1563                                            "state": pd.encounter_provider.facility_state,1564                                            "zip": pd.encounter_provider.facility_postal_code,1565                                            "country": pd.encounter_provider.facility_country_code1566                                        }1567                                    ],1568                                    "phone": [1569                                        {1570                                            "number": pd.encounter_provider.facility_phone,1571                                            "type": "primary work"1572                                        }1573                                    ]1574                                }1575                            ],1576                            "code": [1577                                {1578                                    "name": "UNK",1579                                    "code": "",1580                                    "code_system_name": "Provider Codes"1581                                }1582                            ]1583                        }1584                    ],1585                    "code": {1586                        "name": "Primary Performer",1587                        "code": "PP",1588                        "code_system_name": "Provider Role"1589                    }1590                }1591            ]1592        }1593    };1594    return head;1595}1596function getMeta(pd) {1597    var meta = {};1598    meta = {1599        "type": "CCDA",1600        "identifiers": [1601            {1602                "identifier": "2.16.840.1.113883.19.5.99999.1",1603                "extension": "TT988"1604            }1605        ],1606        "confidentiality": "Normal",1607        "set_id": {1608            "identifier": "2.16.840.1.113883.19.5.99999.19",1609            "extension": "sTT988"1610        }1611    }1612    return meta;1613}1614function genCcda(pd) {1615    var doc = {};1616    var data = {};1617    var count = 0;1618    var many = [];1619    var theone = {};1620    all = pd;1621    npiProvider = all.primary_care_provider.provider[0].npi;1622    oidFacility = all.encounter_provider.facility_oid;1623    npiFacility = all.encounter_provider.facility_npi;1624// Demographics1625    let demographic = populateDemographic(pd.patient, pd.guardian, pd);1626    Object.assign(demographic, populateProviders());1627    data.demographics = Object.assign(demographic);1628// vitals1629    many.vitals = [];1630    try {1631        count = isOne(pd.history_physical.vitals_list.vitals);1632    } catch (e) {1633        count = 01634    }1635    if (count > 1) {1636        for (let i in pd.history_physical.vitals_list.vitals) {1637            theone = populateVital(pd.history_physical.vitals_list.vitals[i]);1638            many.vitals.push.apply(many.vitals, theone);1639        }1640    } else if (count === 1) {1641        theone = populateVital(pd.history_physical.vitals_list.vitals);1642        many.vitals.push(theone);1643    }1644    data.vitals = Object.assign(many.vitals);1645// Medications1646    let meds = [];1647    let m = {};1648    meds.medications = [];1649    try {1650        count = isOne(pd.medications.medication);1651    } catch (e) {1652        count = 01653    }1654    if (count > 1) {1655        for (let i in pd.medications.medication) {1656            m[i] = populateMedication(pd.medications.medication[i]);1657            meds.medications.push(m[i]);1658        }1659    } else if (count !== 0) {1660        m = populateMedication(pd.medications.medication);1661        meds.medications.push(m);1662    }1663    data.medications = Object.assign(meds.medications);1664// Encounters1665    let encs = [];1666    let enc = {};1667    encs.encounters = [];1668    try {1669        count = isOne(pd.encounter_list.encounter);1670    } catch (e) {1671        count = 01672    }1673    if (count > 1) {1674        for (let i in pd.encounter_list.encounter) {1675            enc[i] = populateEncounter(pd.encounter_list.encounter[i]);1676            encs.encounters.push(enc[i]);1677        }1678    } else if (count !== 0) {1679        enc = populateEncounter(pd.encounter_list.encounter);1680        encs.encounters.push(enc);1681    }1682    data.encounters = Object.assign(encs.encounters);1683// Allergies1684    let allergies = [];1685    let allergy = {};1686    allergies.allergies = [];1687    try {1688        count = isOne(pd.allergies.allergy);1689    } catch (e) {1690        count = 01691    }1692    if (count > 1) {1693        for (let i in pd.allergies.allergy) {1694            allergy[i] = populateAllergy(pd.allergies.allergy[i]);1695            allergies.allergies.push(allergy[i]);1696        }1697    } else if (count !== 0) {1698        allergy = populateAllergy(pd.allergies.allergy);1699        allergies.allergies.push(allergy);1700    }1701    data.allergies = Object.assign(allergies.allergies);1702// Problems1703    let problems = [];1704    let problem = {};1705    problems.problems = [];1706    try {1707        count = isOne(pd.problem_lists.problem);1708    } catch (e) {1709        count = 01710    }1711    if (count > 1) {1712        for (let i in pd.problem_lists.problem) {1713            problem[i] = populateProblem(pd.problem_lists.problem[i], pd);1714            problems.problems.push(problem[i]);1715        }1716    } else if (count !== 0) {1717        problem = populateProblem(pd.problem_lists.problem);1718        problems.problems.push(problem);1719    }1720    data.problems = Object.assign(problems.problems);1721// Procedures1722    many = [];1723    theone = {};1724    many.procedures = [];1725    try {1726        count = isOne(pd.procedures.procedure);1727    } catch (e) {1728        count = 01729    }1730    if (count > 1) {1731        for (let i in pd.procedures.procedure) {1732            theone[i] = populateProcedure(pd.procedures.procedure[i]);1733            many.procedures.push(theone[i]);1734        }1735    } else if (count !== 0) {1736        theone = populateProcedure(pd.procedures.procedure);1737        many.procedures.push(theone);1738    }1739    data.procedures = Object.assign(many.procedures);1740// Results1741    if (pd.results)1742        data.results = Object.assign(getResultSet(pd.results, pd)['results']);1743// Immunizations1744    many = [];1745    theone = {};1746    many.immunizations = [];1747    try {1748        count = isOne(pd.immunizations.immunization);1749    } catch (e) {1750        count = 0;1751    }1752    if (count > 1) {1753        for (let i in pd.immunizations.immunization) {1754            theone[i] = populateImmunization(pd.immunizations.immunization[i]);1755            many.immunizations.push(theone[i]);1756        }1757    } else if (count !== 0) {1758        theone = populateImmunization(pd.immunizations.immunization);1759        many.immunizations.push(theone);1760    }1761    data.immunizations = Object.assign(many.immunizations);1762// Plan of Care1763    many = [];1764    theone = {};1765    many.plan_of_care = [];1766    try {1767        count = isOne(pd.planofcare); // ccm doesn't send array of items1768    } catch (e) {1769        count = 01770    }1771    if (count > 1) {1772        for (let i in pd.planofcare.item) {1773            theone[i] = getPlanOfCare(pd.planofcare.item[i]);1774            many.plan_of_care.push(theone[i]);1775        }1776    } else if (count !== 0) {1777        theone = getPlanOfCare(pd.planofcare.item);1778        many.plan_of_care.push(theone);1779    }1780    data.plan_of_care = Object.assign(many.plan_of_care);1781    // Social History1782    many = [];1783    theone = {};1784    many.social_history = [];1785    try {1786        count = isOne(pd.history_physical.social_history.history_element);1787    } catch (e) {1788        count = 01789    }1790    if (count > 1) {1791        for (let i in pd.history_physical.social_history.history_element) {1792            if (i > 0) break;1793            theone[i] = populateSocialHistory(pd.history_physical.social_history.history_element[i]);1794            many.social_history.push(theone[i]);1795        }1796    } else if (count !== 0) {1797        theone = populateSocialHistory(pd.history_physical.social_history.history_element);1798        many.social_history.push(theone);1799    }1800    data.social_history = Object.assign(many.social_history);1801    // ------------------------------------------ End Sections ----------------------------------------//1802    doc.data = Object.assign(data);1803    let meta = getMeta(pd);1804    let header = populateHeader(pd);1805    meta.ccda_header = Object.assign(header);1806    doc.meta = Object.assign(meta);1807    let xml = bbg.generateCCD(doc);1808    // Debug1809    /*fs.writeFile("ccda.json", JSON.stringify(all, null, 4), function (err) {1810        if (err) {1811            return console.log(err);1812        }1813        console.log("Json saved!");1814    });1815    fs.writeFile("ccda.xml", xml, function (err) {1816        if (err) {1817            return console.log(err);1818        }1819        console.log("Xml saved!");1820    });*/1821    return xml;1822}1823function processConnection(connection) {1824    conn = connection; // make it global1825    var remoteAddress = conn.remoteAddress + ':' + conn.remotePort;1826    //console.log(remoteAddress);1827    conn.setEncoding('utf8');1828    var xml_complete = "";1829    function eventData(xml) {1830        xml = xml.replace(/(\u000b|\u001c)/gm, "").trim();1831        // Sanity check from service manager1832        if (xml === 'status' || xml.length < 80) {1833            conn.write("statusok" + String.fromCharCode(28) + "\r\r");1834            conn.end('');1835            return;1836        }1837        xml_complete += xml.toString();1838        if (xml.toString().match(/\<\/CCDA\>$/g)) {1839            // ---------------------start--------------------------------1840            let doc = "";1841            xml_complete = xml_complete.replace(/\t\s+/g, ' ').trim();1842            to_json(xml_complete, function (error, data) {1843                // console.log(JSON.stringify(data, null, 4));1844                if (error) { // need try catch1845                    console.log('toJson error: ' + error + 'Len: ' + xml_complete.length);1846                    return;1847                }1848                doc = genCcda(data.CCDA);1849            });1850            doc = headReplace(doc);1851            doc = doc.toString().replace(/(\u000b|\u001c|\r)/gm, "").trim();1852            //console.log(doc);1853            let chunk = "";1854            let numChunks = Math.ceil(doc.length / 1024);1855            for (let i = 0, o = 0; i < numChunks; ++i, o += 1024) {1856                chunk = doc.substr(o, 1024);1857                conn.write(chunk);1858            }1859            conn.write(String.fromCharCode(28) + "\r\r" + '');1860            conn.end();1861        }1862    }1863    function eventCloseConn() {1864        //console.log('connection from %s closed', remoteAddress);1865    }1866    function eventErrorConn(err) {1867        //console.log('Connection %s error: %s', remoteAddress, err.message);1868    }1869    // Connection Events //1870    conn.on('data', eventData);1871    conn.once('close', eventCloseConn);1872    conn.on('error', eventErrorConn);1873}1874function setUp(server) {1875    server.on('connection', processConnection);1876    server.listen(6661, 'localhost', function () {1877        //console.log('server listening to %j', server.address());1878    });1879}...navtreeindex28.js
Source:navtreeindex28.js  
1var NAVTREEINDEX28 =2{3"group__sdhc__hal.html#ga1b2abe4e9cba2ed6f6f8021613c2dc7a":[2,59,6,8],4"group__sdhc__hal.html#ga2f4daaa2983db5dbcc77c927d8f3b61e":[2,59,6,25],5"group__sdhc__hal.html#ga2fad9b8532fc441cc7e81fe570129276":[2,59,6,24],6"group__sdhc__hal.html#ga3c91df5d99e24d84b4272cb67fe04975":[2,59,6,10],7"group__sdhc__hal.html#ga44ffbfc01a0e684f6ab069347e871e8f":[2,59,6,12],8"group__sdhc__hal.html#ga53c8593881ced4c20dab0477e56bb3bf":[2,59,6,26],9"group__sdhc__hal.html#ga615189e23d7a834d0b5e634c0f406c99":[2,59,6,15],10"group__sdhc__hal.html#ga773e8cc0c854cb041ce6c64545ed9b57":[2,59,6,9],11"group__sdhc__hal.html#ga78a2b6c7de87fd2dbd57393c4f0fda2f":[2,59,6,31],12"group__sdhc__hal.html#ga79f96e224ace1e6e846b290696401ca9":[2,59,6,28],13"group__sdhc__hal.html#ga84153155652abcbd423fe26f7b2bd3f8":[2,59,6,20],14"group__sdhc__hal.html#ga89182f2f0362cdbc4ed569ec98cdf567":[2,59,6,22],15"group__sdhc__hal.html#ga94a8c05b5416cefed931dec1cb2c5fd0":[2,59,6,5],16"group__sdhc__hal.html#gaa5d01ed8ba43a6bf711501c72f1ba5b2":[2,59,6,30],17"group__sdhc__hal.html#gab318fb35a3b2f18cc50a9cfdb438287a":[2,59,6,14],18"group__sdhc__hal.html#gabc69135b92ea32489801b9a906912748":[2,59,6,11],19"group__sdhc__hal.html#gabe733ec4923787104ff5168bf7cdabf7":[2,59,6,13],20"group__sdhc__hal.html#gabeb981bf44b0d9de2a8e4d297cfc3683":[2,59,6,23],21"group__sdhc__hal.html#gabfacaeb84a546da1801289b0c9385f7c":[2,59,6,27],22"group__sdhc__hal.html#gac48b48ee84846fe957a8b715b41ed86a":[2,59,6,29],23"group__sdhc__hal.html#gac51e82b778e228f520f4136351a264c9":[2,59,6,18],24"group__sdhc__hal.html#gac9affd5bc78046a46e0ce4c5b3c7a759":[2,59,6,6],25"group__sdhc__hal.html#gacd8fd80ac5345816bf85d6443a5abbef":[2,59,6,32],26"group__sdhc__hal.html#gad141b05ea192211e52e01fb5888a018b":[2,59,6,7],27"group__sdhc__hal.html#gae315c4db48bf048bac4636152a438f58":[2,59,6,19],28"group__sdhc__hal.html#gaf08d5a02b0af8bea28b9689812c3a62f":[2,59,6,16],29"group__sdhc__hal.html#gafad5a521327bc79cf96cd2d0a46f7860":[2,59,6,17],30"group__sdhc__hal.html#gga44ffbfc01a0e684f6ab069347e871e8fa4408992434d9a182294c2d47bf81713c":[2,59,6,12,0],31"group__sdhc__hal.html#gga44ffbfc01a0e684f6ab069347e871e8fa9095bea2528eb5897626f54e12d77adf":[2,59,6,12,1],32"group__sdhc__hal.html#ggabc69135b92ea32489801b9a906912748a073d3c75b1fa578e643994b5e09c7564":[2,59,6,11,17],33"group__sdhc__hal.html#ggabc69135b92ea32489801b9a906912748a0df8d982f2426282c56c98c04112bdca":[2,59,6,11,22],34"group__sdhc__hal.html#ggabc69135b92ea32489801b9a906912748a1fbe53a3302aa03b81697ae01db37081":[2,59,6,11,10],35"group__sdhc__hal.html#ggabc69135b92ea32489801b9a906912748a26221ea2700bc89938a6573eb5499214":[2,59,6,11,15],36"group__sdhc__hal.html#ggabc69135b92ea32489801b9a906912748a26a0420408ac2694a3f2dac9c2cbee4d":[2,59,6,11,4],37"group__sdhc__hal.html#ggabc69135b92ea32489801b9a906912748a2ac546ab578ed17484ac3f19590d25a5":[2,59,6,11,12],38"group__sdhc__hal.html#ggabc69135b92ea32489801b9a906912748a371ec209858cf72c055cac50dcf97616":[2,59,6,11,18],39"group__sdhc__hal.html#ggabc69135b92ea32489801b9a906912748a572aadd287698216d7bb85fc85a96c35":[2,59,6,11,20],40"group__sdhc__hal.html#ggabc69135b92ea32489801b9a906912748a62ad54c24e80478255461266d9551630":[2,59,6,11,0],41"group__sdhc__hal.html#ggabc69135b92ea32489801b9a906912748a6c70755e24976f96b496f0c858ffecbc":[2,59,6,11,16],42"group__sdhc__hal.html#ggabc69135b92ea32489801b9a906912748a81ce50981bb440bd202666e031e265ec":[2,59,6,11,1],43"group__sdhc__hal.html#ggabc69135b92ea32489801b9a906912748a8d4285a4dd1e6b1856ffbadf975d4ad3":[2,59,6,11,5],44"group__sdhc__hal.html#ggabc69135b92ea32489801b9a906912748a8d82a2e9f934dfb980a6a48c6b86c38c":[2,59,6,11,19],45"group__sdhc__hal.html#ggabc69135b92ea32489801b9a906912748a901d11ecd3aa7646cf1ad691d98676d5":[2,59,6,11,14],46"group__sdhc__hal.html#ggabc69135b92ea32489801b9a906912748aaa5a318297b91b89a73dce6e3d22254f":[2,59,6,11,11],47"group__sdhc__hal.html#ggabc69135b92ea32489801b9a906912748ac3125340997be281741e600fda76aac1":[2,59,6,11,6],48"group__sdhc__hal.html#ggabc69135b92ea32489801b9a906912748ac943a722467b2c932b7375972d0d4bda":[2,59,6,11,7],49"group__sdhc__hal.html#ggabc69135b92ea32489801b9a906912748acb63ad953a9ddbbece7c9c8726f0658c":[2,59,6,11,9],50"group__sdhc__hal.html#ggabc69135b92ea32489801b9a906912748ae39230bcd41bb37cedb7f672570d3818":[2,59,6,11,2],51"group__sdhc__hal.html#ggabc69135b92ea32489801b9a906912748aecc9cd9e74008362741d44b29077e8bf":[2,59,6,11,13],52"group__sdhc__hal.html#ggabc69135b92ea32489801b9a906912748aed2ed28d48d471040056bb4d55287695":[2,59,6,11,8],53"group__sdhc__hal.html#ggabc69135b92ea32489801b9a906912748af3dec876069680f1b17fc538ab85642a":[2,59,6,11,21],54"group__sdhc__hal.html#ggabc69135b92ea32489801b9a906912748af45744b431d62c13d90f785a8a48d598":[2,59,6,11,3],55"group__sdhc__hal.html#structsdhc__hal__basic__info__t":[2,59,6,0],56"group__sdhc__hal.html#structsdhc__hal__cmd__req__t":[2,59,6,4],57"group__sdhc__hal.html#structsdhc__hal__config__t":[2,59,6,3],58"group__sdhc__hal.html#structsdhc__hal__sdclk__config__t":[2,59,6,1],59"group__sdhc__hal.html#structsdhc__mmcboot__param__t":[2,59,6,2],60"group__sdhc__pd.html":[2,59,7],61"group__sdhc__pd.html#ga10739c50ed445bcca53cb37b6336f68d":[2,59,7,2],62"group__sdhc__pd.html#ga17f6951d6ab284ffdf84ce6e6d613c0f":[2,59,7,6],63"group__sdhc__pd.html#ga2361a1f675f373a3647d2c468bb35670":[2,59,7,4],64"group__sdhc__pd.html#ga32929cd74d3bc5f3b810ba44a95c0230":[2,59,7,3],65"group__sdhc__pd.html#ga9eeecad342efbbdec151f6af028e8bca":[2,59,7,5],66"group__sdhc__pd.html#gad9e6d44f6bbaf9df13ff86513117087f":[2,59,7,1],67"group__sdhc__pd.html#gaf704315fe3032d30a55e7c3abf103b7c":[2,59,7,0],68"group__sdhc__pd__data__types.html":[2,59,5],69"group__sdhc__pd__data__types.html#a0d2c900c3962c3a4cdf2212bc8388011":[2,59,5,1,7],70"group__sdhc__pd__data__types.html#a1191ac6167338c84e77806f749b6b4f2":[2,59,5,3,6],71"group__sdhc__pd__data__types.html#a14e7bb95854bbb45c3ba95c843c0b97b":[2,59,5,2,4],72"group__sdhc__pd__data__types.html#a18491973f06fc839b959177d2e833a1d":[2,59,5,1,1],73"group__sdhc__pd__data__types.html#a1c71241384c274e60c39a7423c7aa44e":[2,59,5,0,5],74"group__sdhc__pd__data__types.html#a2160f2a3cad585797d6cf92a3d71ddd1":[2,59,5,3,1],75"group__sdhc__pd__data__types.html#a275c9defd44ef986999a673a5b61691b":[2,59,5,2,2],76"group__sdhc__pd__data__types.html#a27eabf369069e971723e8b114c121625":[2,59,5,1,3],77"group__sdhc__pd__data__types.html#a2ad16315d720ec842a650d16e54ac5c6":[2,59,5,3,5],78"group__sdhc__pd__data__types.html#a2adcaed3509fb47fa515d573f3fb8288":[2,59,5,1,17],79"group__sdhc__pd__data__types.html#a3361fef68fb3cbe578504c060d4cc965":[2,59,5,1,8],80"group__sdhc__pd__data__types.html#a3904efe1ad49bbb5cc111326dc2d1cbf":[2,59,5,1,5],81"group__sdhc__pd__data__types.html#a4c981d74d0b5e7962be58a04c2684ef8":[2,59,5,0,1],82"group__sdhc__pd__data__types.html#a57247db81229d2270532f0a65655459b":[2,59,5,2,1],83"group__sdhc__pd__data__types.html#a59b330e53b76d313d14afafbd2ba4ade":[2,59,5,1,6],84"group__sdhc__pd__data__types.html#a5d4c52041566b716c2474b7555aef985":[2,59,5,1,15],85"group__sdhc__pd__data__types.html#a6eb9c8a91b45e79e184d5fecd84234ba":[2,59,5,1,14],86"group__sdhc__pd__data__types.html#a80a40e9b9b765f57be825af6cab8be3d":[2,59,5,0,2],87"group__sdhc__pd__data__types.html#a85aa68b994e1048beab3934327afa230":[2,59,5,1,13],88"group__sdhc__pd__data__types.html#a8e07e03a55b7e69c972c63aa0fc6830d":[2,59,5,3,4],89"group__sdhc__pd__data__types.html#a8e401c88bde0bba28bfd9feefa0ee48d":[2,59,5,3,0],90"group__sdhc__pd__data__types.html#a914e581b4aa11448284a6e238a1d8af2":[2,59,5,1,12],91"group__sdhc__pd__data__types.html#a9263d73069f8fef3b280b63e607305ec":[2,59,5,0,3],92"group__sdhc__pd__data__types.html#a9bbea9e00786eeaa965325f1e393feef":[2,59,5,1,2],93"group__sdhc__pd__data__types.html#a9f7f47e15ee1ce5eeff45f81c73d04cc":[2,59,5,1,16],94"group__sdhc__pd__data__types.html#aa64d6e2289286800386ebcd1663224ff":[2,59,5,1,9],95"group__sdhc__pd__data__types.html#aa97694654eefc85e6e2fb305ec500148":[2,59,5,0,0],96"group__sdhc__pd__data__types.html#ab0528be3ab725c06b0d417b26e514756":[2,59,5,2,0],97"group__sdhc__pd__data__types.html#ab7221eea41825a838bf4fb6710e579d7":[2,59,5,1,0],98"group__sdhc__pd__data__types.html#abd580274f521321f39ccdb48e1e4a732":[2,59,5,3,2],99"group__sdhc__pd__data__types.html#abe50a6190b78c43acfe7413c359078ff":[2,59,5,3,3],100"group__sdhc__pd__data__types.html#ac28b644b68c01545c84e210890644872":[2,59,5,3,8],101"group__sdhc__pd__data__types.html#ac9108ac4d7ce02f2dda976772cd1bca7":[2,59,5,2,3],102"group__sdhc__pd__data__types.html#ad0fb5333bdce3c6d93192dae2721158e":[2,59,5,1,11],103"group__sdhc__pd__data__types.html#ad33b4d78560553c87f12571e9cc5d62e":[2,59,5,3,7],104"group__sdhc__pd__data__types.html#ae9a834541e0d04666fc47dc6b0344c04":[2,59,5,1,4],105"group__sdhc__pd__data__types.html#aeef9f56b5279a980211233e771c5103d":[2,59,5,1,10],106"group__sdhc__pd__data__types.html#af713b645442bdb2ae99f7edf68ff2d4a":[2,59,5,0,4],107"group__sdhc__pd__data__types.html#ga2c8f007bb678bcb30432a8524dcda2e8":[2,59,5,8],108"group__sdhc__pd__data__types.html#ga44452e2b75f4fe056a8ef6fced8fa793":[2,59,5,5],109"group__sdhc__pd__data__types.html#ga7e355e95de9ec2f13285ec26daf2362e":[2,59,5,4],110"group__sdhc__pd__data__types.html#ga9947751496e506e08bc4bb6edb607dd5":[2,59,5,9],111"group__sdhc__pd__data__types.html#gabf68ed04c005b01cf23baac4840acb7d":[2,59,5,6],112"group__sdhc__pd__data__types.html#gacc942ca62dd2676adf2beabc09c61aaa":[2,59,5,7],113"group__sdhc__pd__data__types.html#gga2c8f007bb678bcb30432a8524dcda2e8a21d4efc78042a0427d4da5409a8cd3e2":[2,59,5,8,1],114"group__sdhc__pd__data__types.html#gga2c8f007bb678bcb30432a8524dcda2e8a7b2b7dcc2cf21b66091adc94c63adb32":[2,59,5,8,3],115"group__sdhc__pd__data__types.html#gga2c8f007bb678bcb30432a8524dcda2e8a9027d06386ff44a7102b64817445a9a8":[2,59,5,8,2],116"group__sdhc__pd__data__types.html#gga2c8f007bb678bcb30432a8524dcda2e8acb807c9de3e957a3727372c8803f7e06":[2,59,5,8,0],117"group__sdhc__pd__data__types.html#gga44452e2b75f4fe056a8ef6fced8fa793a4e6372661dc5e0b5c08dfd5302a1178c":[2,59,5,5,0],118"group__sdhc__pd__data__types.html#gga44452e2b75f4fe056a8ef6fced8fa793a5d478a7fb67af927723ad8009b202c75":[2,59,5,5,2],119"group__sdhc__pd__data__types.html#gga44452e2b75f4fe056a8ef6fced8fa793aa0d9aff86d678c896ee31bdd586ae8a8":[2,59,5,5,3],120"group__sdhc__pd__data__types.html#gga44452e2b75f4fe056a8ef6fced8fa793aab011c030ec9646979f10a83ffd6b8e0":[2,59,5,5,4],121"group__sdhc__pd__data__types.html#gga44452e2b75f4fe056a8ef6fced8fa793abe76f1412667887567639cb05954bf5b":[2,59,5,5,1],122"group__sdhc__pd__data__types.html#gga7e355e95de9ec2f13285ec26daf2362ea08f42906973f35075e850c4d75353176":[2,59,5,4,25],123"group__sdhc__pd__data__types.html#gga7e355e95de9ec2f13285ec26daf2362ea0a6cb176e261e1524f959543403b15c2":[2,59,5,4,29],124"group__sdhc__pd__data__types.html#gga7e355e95de9ec2f13285ec26daf2362ea0b9e99c1d3f3446eab41f6f7bdb5cb6f":[2,59,5,4,17],125"group__sdhc__pd__data__types.html#gga7e355e95de9ec2f13285ec26daf2362ea0d41e0701bef072d419be4ff1ac68254":[2,59,5,4,4],126"group__sdhc__pd__data__types.html#gga7e355e95de9ec2f13285ec26daf2362ea0e4958a59149b411ac85b981ec5defa6":[2,59,5,4,2],127"group__sdhc__pd__data__types.html#gga7e355e95de9ec2f13285ec26daf2362ea0e4b7182ee743027c623b7c9ce13669f":[2,59,5,4,24],128"group__sdhc__pd__data__types.html#gga7e355e95de9ec2f13285ec26daf2362ea13d1b4d0062b8ebc92475f7f335fa4c4":[2,59,5,4,21],129"group__sdhc__pd__data__types.html#gga7e355e95de9ec2f13285ec26daf2362ea14bab95590e6e408c6a7ec9e37634e43":[2,59,5,4,33],130"group__sdhc__pd__data__types.html#gga7e355e95de9ec2f13285ec26daf2362ea1a48462f15a33c9e34e2ce93060e8cd3":[2,59,5,4,30],131"group__sdhc__pd__data__types.html#gga7e355e95de9ec2f13285ec26daf2362ea2474c0f9c18a39cd47db87f1f8a45ceb":[2,59,5,4,34],132"group__sdhc__pd__data__types.html#gga7e355e95de9ec2f13285ec26daf2362ea386a357f1b8f0ca7fcdfc371cf04822a":[2,59,5,4,16],133"group__sdhc__pd__data__types.html#gga7e355e95de9ec2f13285ec26daf2362ea3e239135e30a53ead25f0ba6d983ebcf":[2,59,5,4,22],134"group__sdhc__pd__data__types.html#gga7e355e95de9ec2f13285ec26daf2362ea44f73611f284ce934e025dd9924f7eb3":[2,59,5,4,10],135"group__sdhc__pd__data__types.html#gga7e355e95de9ec2f13285ec26daf2362ea536990ef8c6b1d5e77c87a3364d5cc27":[2,59,5,4,23],136"group__sdhc__pd__data__types.html#gga7e355e95de9ec2f13285ec26daf2362ea57e4d9dc88b64e8788e5a8ca0afbca3c":[2,59,5,4,0],137"group__sdhc__pd__data__types.html#gga7e355e95de9ec2f13285ec26daf2362ea6731f6035602dcdc30d410f8ba1c8258":[2,59,5,4,14],138"group__sdhc__pd__data__types.html#gga7e355e95de9ec2f13285ec26daf2362ea69d63777f4f68da38641fc12d60a3bc6":[2,59,5,4,9],139"group__sdhc__pd__data__types.html#gga7e355e95de9ec2f13285ec26daf2362ea6d1b71d7d7d51cc30f2fb9d781600171":[2,59,5,4,40],140"group__sdhc__pd__data__types.html#gga7e355e95de9ec2f13285ec26daf2362ea6d1f6326dff7533d949b00cb6fee94ef":[2,59,5,4,35],141"group__sdhc__pd__data__types.html#gga7e355e95de9ec2f13285ec26daf2362ea6e07fe56df153e79027ffb3afad1f077":[2,59,5,4,7],142"group__sdhc__pd__data__types.html#gga7e355e95de9ec2f13285ec26daf2362ea79b34e606a314e373762f70c1ee6fe28":[2,59,5,4,5],143"group__sdhc__pd__data__types.html#gga7e355e95de9ec2f13285ec26daf2362ea9376587b7b61dba6eb86246e711b64fd":[2,59,5,4,1],144"group__sdhc__pd__data__types.html#gga7e355e95de9ec2f13285ec26daf2362ea9be33d93177fcf2ea1b0cff972041439":[2,59,5,4,36],145"group__sdhc__pd__data__types.html#gga7e355e95de9ec2f13285ec26daf2362ea9eec027cfb29474874080aa9d1251258":[2,59,5,4,6],146"group__sdhc__pd__data__types.html#gga7e355e95de9ec2f13285ec26daf2362ea9fd35f9a09fe26392e8c4b229ec3c1c1":[2,59,5,4,20],147"group__sdhc__pd__data__types.html#gga7e355e95de9ec2f13285ec26daf2362eaa82976239b38f8a1707898a04adee10e":[2,59,5,4,8],148"group__sdhc__pd__data__types.html#gga7e355e95de9ec2f13285ec26daf2362eaa8e5c04a1b9674660871e0d59560f577":[2,59,5,4,11],149"group__sdhc__pd__data__types.html#gga7e355e95de9ec2f13285ec26daf2362eaaf58b950078921c2ac0c79cd8a26810d":[2,59,5,4,37],150"group__sdhc__pd__data__types.html#gga7e355e95de9ec2f13285ec26daf2362eab246eff8720ee180a59a80c47a65e692":[2,59,5,4,27],151"group__sdhc__pd__data__types.html#gga7e355e95de9ec2f13285ec26daf2362eab6c52027dea09b0e0700351c12eab04e":[2,59,5,4,26],152"group__sdhc__pd__data__types.html#gga7e355e95de9ec2f13285ec26daf2362eab79960767b1d941b28e1cc7519df98c8":[2,59,5,4,32],153"group__sdhc__pd__data__types.html#gga7e355e95de9ec2f13285ec26daf2362eab98dbd4c4b0d4b713275e19ea5bfb7f2":[2,59,5,4,12],154"group__sdhc__pd__data__types.html#gga7e355e95de9ec2f13285ec26daf2362eac2b04746bcd703768767568bacc7ea16":[2,59,5,4,15],155"group__sdhc__pd__data__types.html#gga7e355e95de9ec2f13285ec26daf2362eacd7a1a8977e698fbbd74e674819fe36e":[2,59,5,4,39],156"group__sdhc__pd__data__types.html#gga7e355e95de9ec2f13285ec26daf2362ead39af30df222bccbfff6de2e3e09aca0":[2,59,5,4,31],157"group__sdhc__pd__data__types.html#gga7e355e95de9ec2f13285ec26daf2362ead79712c6e0ee76b2117439ea2c077221":[2,59,5,4,3],158"group__sdhc__pd__data__types.html#gga7e355e95de9ec2f13285ec26daf2362ead82f5345c903c18e356f5c1d7fe1d948":[2,59,5,4,13],159"group__sdhc__pd__data__types.html#gga7e355e95de9ec2f13285ec26daf2362eae8b78929aada3026e1679784681a570c":[2,59,5,4,19],160"group__sdhc__pd__data__types.html#gga7e355e95de9ec2f13285ec26daf2362eaf4a8dff96b7d3bef648cf1d24a453b17":[2,59,5,4,18],161"group__sdhc__pd__data__types.html#gga7e355e95de9ec2f13285ec26daf2362eafc5e3c623a03e7dab2d6b7e6a0c4ed02":[2,59,5,4,38],162"group__sdhc__pd__data__types.html#gga7e355e95de9ec2f13285ec26daf2362eafda086f47ecdaf7e49418bf619759dc8":[2,59,5,4,28],163"group__sdhc__pd__data__types.html#gga9947751496e506e08bc4bb6edb607dd5a1dff2cf9be1410064252d5a0c05a0976":[2,59,5,9,6],164"group__sdhc__pd__data__types.html#gga9947751496e506e08bc4bb6edb607dd5a2311f2ce6df2555b9f3656d215b83c6d":[2,59,5,9,5],165"group__sdhc__pd__data__types.html#gga9947751496e506e08bc4bb6edb607dd5a239a6fd10383ef44dd59b125854f8214":[2,59,5,9,2],166"group__sdhc__pd__data__types.html#gga9947751496e506e08bc4bb6edb607dd5a363fff5fab34ac8f3c9c2c9b45916fff":[2,59,5,9,0],167"group__sdhc__pd__data__types.html#gga9947751496e506e08bc4bb6edb607dd5a3a2dc7b7c26fba0436e8fbc0fb62f568":[2,59,5,9,4],168"group__sdhc__pd__data__types.html#gga9947751496e506e08bc4bb6edb607dd5a70e7f1593a5713a82b963389928f18e4":[2,59,5,9,1],169"group__sdhc__pd__data__types.html#gga9947751496e506e08bc4bb6edb607dd5a93b27e10c51c2c8b5e41fbfc651f2707":[2,59,5,9,9],170"group__sdhc__pd__data__types.html#gga9947751496e506e08bc4bb6edb607dd5aa067ca53687c3eea14ad8328a2d85084":[2,59,5,9,7],171"group__sdhc__pd__data__types.html#gga9947751496e506e08bc4bb6edb607dd5acb29e9b3a6e0b77ac979554150b79288":[2,59,5,9,8],172"group__sdhc__pd__data__types.html#gga9947751496e506e08bc4bb6edb607dd5acf24507091b94646d16c4f66919d3c12":[2,59,5,9,3],173"group__sdhc__pd__data__types.html#ggabf68ed04c005b01cf23baac4840acb7da550a8eca408618e41ea4ace26c0ed5dc":[2,59,5,6,1],174"group__sdhc__pd__data__types.html#ggabf68ed04c005b01cf23baac4840acb7da58f85708b3d107ebc1682563b988491e":[2,59,5,6,0],175"group__sdhc__pd__data__types.html#ggabf68ed04c005b01cf23baac4840acb7da862b21bcd3d25395db846bc157f8edb5":[2,59,5,6,2],176"group__sdhc__pd__data__types.html#ggacc942ca62dd2676adf2beabc09c61aaaa0be47fa4fbe5f53be074bd974e2e46ac":[2,59,5,7,1],177"group__sdhc__pd__data__types.html#ggacc942ca62dd2676adf2beabc09c61aaaa69928b5b7e17380e98eecf3f22116395":[2,59,5,7,0],178"group__sdhc__pd__data__types.html#ggacc942ca62dd2676adf2beabc09c61aaaadc313205d0af6cef9fe9383219d27045":[2,59,5,7,2],179"group__sdhc__pd__data__types.html#structsdhc__data__t":[2,59,5,2],180"group__sdhc__pd__data__types.html#structsdhc__host__t":[2,59,5,1],181"group__sdhc__pd__data__types.html#structsdhc__request__t":[2,59,5,3],182"group__sdhc__pd__data__types.html#structsdhc__user__config__t":[2,59,5,0],183"group__sdhc__std__def.html":[2,59,8],184"group__sdhc__std__def.html#ga017f0ac45c5e74603864842372413d5b":[2,59,8,195],185"group__sdhc__std__def.html#ga019ff9ea848b4bd106949ef7fa6c8421":[2,59,8,30],186"group__sdhc__std__def.html#ga029ebfd364158145061aaf3b71397e3d":[2,59,8,74],187"group__sdhc__std__def.html#ga02ad784af3031742503162e796226d54":[2,59,8,192],188"group__sdhc__std__def.html#ga050c4c998f0efaa92e76ac32eaab4afa":[2,59,8,169],189"group__sdhc__std__def.html#ga063a943b71aac282b21e14f5cba14a5d":[2,59,8,70],190"group__sdhc__std__def.html#ga06495e030760bf69a7c89024698e1988":[2,59,8,153],191"group__sdhc__std__def.html#ga08b0237e485a7e9a405687932ed8c6d7":[2,59,8,33],192"group__sdhc__std__def.html#ga091709bdfbfe9bebd1b1c0b713a729c0":[2,59,8,188],193"group__sdhc__std__def.html#ga0a2b446f5b33d3f9f11951f2cd6d770d":[2,59,8,61],194"group__sdhc__std__def.html#ga0be8993b6365f8cf36505378d4c909f7":[2,59,8,2],195"group__sdhc__std__def.html#ga0d2da6437c92dcbeed2fa660a6d4d6bf":[2,59,8,34],196"group__sdhc__std__def.html#ga0d9c56085091152b4982bf095e1e2a8c":[2,59,8,141],197"group__sdhc__std__def.html#ga0fc823cb2042ace36bdaa4ec4f56aa7a":[2,59,8,157],198"group__sdhc__std__def.html#ga11d7d292d3f688e2bc29c428ccaca5e8":[2,59,8,6],199"group__sdhc__std__def.html#ga14a4a57fb27e7049ff819cad785916ee":[2,59,8,138],200"group__sdhc__std__def.html#ga158ffd19d6523275dbe12dbe63fce797":[2,59,8,124],201"group__sdhc__std__def.html#ga18b0a8ae6c943b7158d4eb6924ed7c52":[2,59,8,53],202"group__sdhc__std__def.html#ga18d0a5496759dac5dbe04fc03894788d":[2,59,8,98],203"group__sdhc__std__def.html#ga18d902ccae81b2660efb87fcff0b915c":[2,59,8,63],204"group__sdhc__std__def.html#ga199e63dce755d71309bd0790a00def1c":[2,59,8,42],205"group__sdhc__std__def.html#ga1b484ab2f59f670c8d803e19e879dbf0":[2,59,8,154],206"group__sdhc__std__def.html#ga1bfeca8d66c8ab6f7746ed547e86dd45":[2,59,8,45],207"group__sdhc__std__def.html#ga1d65948d7a8468bca5b10052b212b74d":[2,59,8,64],208"group__sdhc__std__def.html#ga1e15684d4ed85110cac4aea2e3ef8acf":[2,59,8,111],209"group__sdhc__std__def.html#ga1e54bda83f2ee72a14a043f05aa4b4f4":[2,59,8,155],210"group__sdhc__std__def.html#ga1ea97c77eb0f8d5df39e5a4ce14989d2":[2,59,8,9],211"group__sdhc__std__def.html#ga20fb6a3bdfb0b3ef24d1b7d0f7473e94":[2,59,8,162],212"group__sdhc__std__def.html#ga22283880c591db7c039a4987c2ebcb61":[2,59,8,29],213"group__sdhc__std__def.html#ga2232590ec8d976ed82817bff00f8c9af":[2,59,8,46],214"group__sdhc__std__def.html#ga23f25aef07819f31f6545dcc7344bf7a":[2,59,8,151],215"group__sdhc__std__def.html#ga24123af385f5b4a67610414afb7bb0bd":[2,59,8,32],216"group__sdhc__std__def.html#ga284058f50e306b883f68a7c672efbe10":[2,59,8,104],217"group__sdhc__std__def.html#ga2896a851e90a6e1e364b38578fcb94d3":[2,59,8,175],218"group__sdhc__std__def.html#ga29cda8730af7c69d111bf2f088d96422":[2,59,8,110],219"group__sdhc__std__def.html#ga2ba14d63dab5fdfeaa8891977183d814":[2,59,8,22],220"group__sdhc__std__def.html#ga2c5022e87172799641ba01cd5935fbc9":[2,59,8,15],221"group__sdhc__std__def.html#ga2e357a2642495ca27bcacce5e3b069c1":[2,59,8,95],222"group__sdhc__std__def.html#ga2edc0103c43ae18cb2ff35441d4b6615":[2,59,8,194],223"group__sdhc__std__def.html#ga30fab505198fa2382fb8a8337e47e9e9":[2,59,8,83],224"group__sdhc__std__def.html#ga314865ac9fb109759333e330b8f2b391":[2,59,8,130],225"group__sdhc__std__def.html#ga317a1a244a973787bd8f6befa06ae4f9":[2,59,8,121],226"group__sdhc__std__def.html#ga33ae795e54613a80b793ab80c73ff96f":[2,59,8,82],227"group__sdhc__std__def.html#ga351eb37ed230d1dfb10c937af2e916ce":[2,59,8,120],228"group__sdhc__std__def.html#ga353d1aea62373e409437923c8c49dc76":[2,59,8,165],229"group__sdhc__std__def.html#ga370740c7ce630a69c9f4c960fdad57e4":[2,59,8,145],230"group__sdhc__std__def.html#ga370e410f3ae66857e04126b69ddc5075":[2,59,8,102],231"group__sdhc__std__def.html#ga38929d080e7a410fb92761a35124a773":[2,59,8,37],232"group__sdhc__std__def.html#ga39e086ed10ecc1cb7443e7da9a4689fb":[2,59,8,174],233"group__sdhc__std__def.html#ga3b1289329c4a05e0f565790bf17db3af":[2,59,8,171],234"group__sdhc__std__def.html#ga3b5be7967d5f2ec353143635e31960c3":[2,59,8,113],235"group__sdhc__std__def.html#ga3cce10fe947c1887437d4fdb195614f7":[2,59,8,178],236"group__sdhc__std__def.html#ga3e2337ce29746e81806b38db5c30d7b9":[2,59,8,18],237"group__sdhc__std__def.html#ga3e2a4d3c6ac3f7a3a97f11be34de12c4":[2,59,8,81],238"group__sdhc__std__def.html#ga3fd1bf0205d4036a62272adca87f5506":[2,59,8,176],239"group__sdhc__std__def.html#ga4126f9c04468801872096e6f240b8f54":[2,59,8,69],240"group__sdhc__std__def.html#ga416006ec0465e826dc4beaf7ce86cceb":[2,59,8,28],241"group__sdhc__std__def.html#ga424c8c49a33250de466985033542a402":[2,59,8,101],242"group__sdhc__std__def.html#ga42c8848b2b678be4cc8b195ff1f1fce8":[2,59,8,167],243"group__sdhc__std__def.html#ga431e5846a6e97f6497c4469b146356ab":[2,59,8,100],244"group__sdhc__std__def.html#ga44df7730c1822ffbcd21902203140598":[2,59,8,57],245"group__sdhc__std__def.html#ga44f1904ab2dea31c1d7391ed7e36d1f6":[2,59,8,38],246"group__sdhc__std__def.html#ga459adf6d0fb918d0d4b0e010e95ba109":[2,59,8,199],247"group__sdhc__std__def.html#ga46693efe2ce5afe0cc81d201aadb4b04":[2,59,8,94],248"group__sdhc__std__def.html#ga466f50356ee753bf149dac14bd32dd12":[2,59,8,54],249"group__sdhc__std__def.html#ga46e12e53d79905c864e73f28305dcf31":[2,59,8,129],250"group__sdhc__std__def.html#ga482d8ba0f568f8a99dc62a2011cc1053":[2,59,8,128],251"group__sdhc__std__def.html#ga48ac6e8f9354723dcb5e205beaf89d96":[2,59,8,51],252"group__sdhc__std__def.html#ga4a97c30d1e560b1d697fb430d7952acd":[2,59,8,117]...script.js
Source:script.js  
1$(document).ready(function(){2    //#0. 구ì±ì ëí ì¤íì¼ ì ì©3    //#1. ë°°ì´ ë°ì´í°ë¥¼ 구ì±4    //2ì°¨ ë°°ì´ ë°ì´í° = ["ì´ë¯¸ì§", "íì´í", "ë´ì©", "ê°ê²©ì ë³´", "ë ì§", "ì¢ìì íì"]5    6    var $pd_arr = [7        ["img1.jpg", "ê±°ì¤ ì¸í
리ì´1", "í©ë¦¬ì ì¸ ì¤ì©ì£¼ì ì¸í
리ì´1", "30000", "20211005", "4"],8        ["img2.jpg", "ê±°ì¤ ì¸í
리ì´5", "í©ë¦¬ì ì¸ ì¤ì©ì£¼ì ì¸í
리ì´5", "120000", "20211011", "73"],9        ["img3.jpg", "ì¹¨ì¤ ì¸í
리ì´2", "미ëë©ë¦¬ì¦ ì¹¨ì¤ ì¸í
리ì´2", "70000", "2021022", "56"],10        ["img4.jpg", "ì¹¨ì¤ ì¸í
리ì´3", "모ëëì¦ ì¹¨ì¤ ì¸í
리ì´3", "90000", "20210807", "23"],11        ["img5.jpg", "주방 ì¸í
리ì´1", "ì르ëë³´ ì¤íì¼ ì£¼ë°© ì¸í
리ì´1", "80000", "20201231", "105"],12        ["img6.jpg", "ê±°ì¤ ì¸í
리ì´8", "í©ë¦¬ì ì¸ ì¤ì©ì£¼ì ì¸í
리ì´8", "140000", "20210328", "97"],13        ["img7.jpg", "ìì¬ ì¸í
리ì´4", "미ëë©ë¦¬ì¦ ì¸í
리ì´4", "72000", "20210408", "47"],14        ["img8.jpg", "ìì¤ ì¸í
리ì´3", "í¬ì¤í¸ëª¨ëëì¦ ì¸í
리ì´1", "95000", "20210117", "64"],15        ["img9.jpg", "ê±°ì¤ ì¸í
리ì´6", "í©ë¦¬ì ì¸ ì¤ì©ì£¼ì ì¸í
리ì´6", "28000", "20210329", "71"],16        ["img1.jpg", "ê±°ì¤ ì¸í
리ì´1", "í©ë¦¬ì ì¸ ì¤ì©ì£¼ì ì¸í
리ì´1", "30000", "20211006", "4"],17        ["img2.jpg", "ê±°ì¤ ì¸í
리ì´5", "í©ë¦¬ì ì¸ ì¤ì©ì£¼ì ì¸í
리ì´5", "120000", "20211021", "73"],18        ["img3.jpg", "ì¹¨ì¤ ì¸í
리ì´2", "미ëë©ë¦¬ì¦ ì¹¨ì¤ ì¸í
리ì´2", "70000", "20210923", "56"],19        ["img4.jpg", "ì¹¨ì¤ ì¸í
리ì´3", "모ëëì¦ ì¹¨ì¤ ì¸í
리ì´3", "90000", "20210507", "24"],20        ["img5.jpg", "주방 ì¸í
리ì´1", "ì르ëë³´ ì¤íì¼ ì£¼ë°© ì¸í
리ì´1", "80000", "20201131", "115"],21        ["img6.jpg", "ê±°ì¤ ì¸í
리ì´8", "í©ë¦¬ì ì¸ ì¤ì©ì£¼ì ì¸í
리ì´8", "140000", "20210318", "96"],22        ["img7.jpg", "ìì¬ ì¸í
리ì´4", "미ëë©ë¦¬ì¦ ì¸í
리ì´4", "72000", "20210418", "45"],23        ["img8.jpg", "ìì¤ ì¸í
리ì´3", "í¬ì¤í¸ëª¨ëëì¦ ì¸í
리ì´1", "95000", "20210128", "60"],24        ["img9.jpg", "ê±°ì¤ ì¸í
리ì´6", "í©ë¦¬ì ì¸ ì¤ì©ì£¼ì ì¸í
리ì´6", "28000", "20210327", "85"],25    ];26    //#2. í¨í´íí  êµ¬ì¡°ë¥¼ ì ì¥27    var $pd_box = 28    `29        <div class="pd_box">30            <div class="pd_photo">31                <img src="./img/img1.jpg" alt="">32            </div>33            <div class="pd_info">34                <h3 class="pd_title">Title</h3>35                <p class="pd_text">Content</p>36                <div class="pd_etc">37                    <span class="pd_price">ê°ê²©ì ë³´</span>38                    <span class="pd_date">ì
ë°ì´í¸ ë ì§</span>39                </div>40                <p class="fav">ì¢ìì  <span>50</span></p>41            </div>42        </div>43    `;44    //console.log($pd_box);45    //#3. for문ì íì©íì¬ ë°°ì´ ë°ì´í°ì ê°ìë§í¼ ë°ë³µë¬¸ì ë리면ì HTMLì 구조í를 ì§í46    for(i=0; i<$pd_arr.length; i++){47        $(".pd_frame").append($pd_box);48    }49    //ìë¨ì sort ë²í¼ì í´ë¦íì ë ì¸ë±ì¤ ë²í¸ë¥¼ ì¶ì¶. ì를 ë¤ì´ "ìµì ì"ì´ë¼ë ë²í¼ì í´ë¦íë¤ë©´ ì¸ë±ì¤ ë²í¸ë 050    var $btn_index;51    //#4. each문ì¼ë¡ ìì°¨ì  ì ê·¼ ê³¼ì ìì ë°ì´í°ë¥¼ ë£ì´ì¤ë¤.52   53    function pd_sort(){54        $(".pd_box").each(function(index){55            $(this).find(".pd_photo img").attr("src", "./img/"+$pd_arr[index][0]);56            $(this).find(".pd_title").text($pd_arr[index][1]);57            $(this).find(".pd_text").text($pd_arr[index][2]);58            $(this).find(".pd_price").text($pd_arr[index][3].replace(/\B(?=(\d{3})+(?!\d))/g, ","));59            $(this).find(".pd_date").text($pd_arr[index][4]);60            $(this).find(".fav span").text($pd_arr[index][5]);61        62        });63        //console.log(this) //í´ë¦í ê³³ì ììê° ìë ìµìë¨ì document ==> ready ì´ë²¤í¸ì 주체 ... í¨ì문 ë´ë¶ìì ì¬ì© ë¶ê°64        $(".sort_button button").removeClass("active");65        $(".sort_button button").eq($btn_index).addClass("active");66        //4ê°ì¤ íëì ë²í¼ì í´ë¦íì ë, ì
ë í¸ ë°ì¤ì ìµì
ì ì ííëë¡ íë¤.67        $(".sort_sel option").prop("selected", false);68        $(".sort_sel option").eq($btn_index + 1).prop("selected", true);69    };70    pd_sort();71    //sort() : ìì¤í¤ ì½ë ìì ìì ì ë¶í° í° ì ìì¼ë¡ ëì´ëë ë°©ì72    var $test1 = ["graph", "apple", "cherry"];73    $test1.sort();74    console.log($test1); //['apple', 'cherry', 'graph'] : a(97) ~ z(122) 문ì ììì 첫 ê¸ìì ìì¤í¤ì½ëìì ê° ìì¼ë¡ ëì´ë¨75    var $test2 = ["7200", "10000", "27000"]; //['10000', '27000', '7200'] : ê°ì¥ ë¨¼ì  ì²ìì ë°°ì¹ë ì«ì를 ë¹êµíì¬ ììëë¡ ëì´ë¨76    $test2.sort();77    console.log($test2); 78    var $test3 = ["3000", "12000", "5000"];79    $test3.sort(function(a, b){80        return a - b; // 3000 - 12000 => ìì(false)[ì리ë³ë ìì]; ... 12000 - 5000 => ìì(true)[ì리ë³ë]81    });82    console.log($test3);83    84    //ìµì ìì¼ë¡ ì ë ¬ - ë²í¼85    $(".date_sort").click(function(){86        $pd_arr.sort(function(a, b){87            //return a[4] - b[4]; ì¤ë¦ì°¨ìì¼ë¡ ì ë ¬88            return b[4] - a[4]; //ë´ë¦¼ì°¨ìì¼ë¡ ì ë ¬89        });90        console.log($pd_arr); //0ë² ì¸ë±ì¤ì ë³ê²½ë 2ì°¨ ë°°ì´ì 4ë² ì¸ë±ì¤ ë°ì´í° : ê°ì¥ ì¤ëë ë ì§ë¥¼ ì§ì¹91        92        //$pd_arr.reverse(); // íì¬ ë°°ì´ì ë°ì´í°ë¥¼ ììì¼ë¡ ë린ë¤93        //console.log($pd_arr);94        $btn_index = $(this).index();95        pd_sort(); //ë°°ì´ ë°ì´í°ì sortê³¼ì ì´ ì¢
ë£ëë©´ í¨ì문ì í¸ì¶íì¬ ë°ì´í°ë¥¼ ë¤ì ë£ì´ì¤ë¤.96    });97    //"ì ê°ì"ì¼ë¡ ì ë ¬ - ë²í¼98    $(".low_sort").click(function(){99        $pd_arr.sort(function(a, b){100    101            return a[3] - b[3]; 102        });103        $btn_index = $(this).index();104        pd_sort();105    });106    //"ê³ ê°ì"ì¼ë¡ ì ë ¬ - ë²í¼107    $(".high_sort").click(function(){108        $pd_arr.sort(function(a, b){109    110            return b[3] - a[3]; 111        });112        $btn_index = $(this).index();113        pd_sort();114    });115    //"ì¸ê¸°ì"ì¼ë¡ ì ë ¬ - ë²í¼116    $(".fav_sort").click(function(){117        $pd_arr.sort(function(a, b){118    119            return b[5] - a[5]; 120        });121        $btn_index = $(this).index();122        pd_sort();123    });124    125    //ì
ë í¸ ë°ì¤ì value ê°ì ìí ìí ì ë ¬126    $(".sort_sel").change(function(){127        var $sel_val = $(this).val();128        console.log($sel_val);129        if($sel_val == "date"){ //ìµì ì130            $pd_arr.sort(function(a, b){131                132                return b[4] - a[4];133            });134        }else if($sel_val == "high"){ //ê³ ê°ì135            $pd_arr.sort(function(a, b){136    137                return b[3] - a[3]; 138            });139        }else if($sel_val == "low"){ //ì ê°ì140            $pd_arr.sort(function(a, b){141    142                return a[3] - b[3]; 143            });144        }else if($sel_val == "fav"){ //ì¸ê¸°ì145            $pd_arr.sort(function(a, b){146    147                return b[5] - a[5]; 148            });149        }150        pd_sort();151        //íë²ì´ë¼ë ì¬ì©ìê° ì íì íê³  ëë©´ ì íì´ë¼ë ì
ë í¸ ë°ì¤ì ìµì
ì ì íëì§ ëª»íëë¡ êµ¬ì±152        $(".sort_sel option").eq(0).prop("disabled", true);153        //$(".sort_sel option").eq(0).remove();154        //$(".sort_sel option:contains('ì í)").remove(); //"ì í"ì´ë¼ë í
ì¤í¸ë¥¼ í¬í¨íê³  ìë ìµì
 íê·¸ë§ ì í155        $(".sort_button button").removeClass("active");156        $(".sort_button button[class*='"+$sel_val+"']").addClass("active");157        $(".sort_sel option").prop("selected", false); //ì
ë í¸ ë°ì¤ìì ì íì 모ë í´ì 158        $(".sort_sel option[value='"+$sel_val+"']").prop("selected", true); //ì íí ê³³ì value ê°ê³¼ ì¼ì¹íë ê³³ì¼ë¡ ë³ê²½ëê²ë ì¤ì 159    });160    //[CSS ìì±ì íì]161    //[ìì±ëª
='ìì±ê°'] : í´ë¹ ìì±ëª
ê³¼ ìì±ê°ë§ ì ííê² ì¼ì¹íë ìì를 ì í162    //[ìì±ëª
*='ìì±ê°'] : í´ë¹ ìì±ëª
ì ìì±ê°ì í¬í¨íê³  ìë ìì를 ì í163    //[ìì±ëª
^='ìì±ê°'] : í´ë¹ ìì±ëª
ì í´ë¹ ìì±ê°ì¼ë¡ ììíë ìì를 ì í164    //[ìì±ëª
$='ìì±ê°'] : í´ë¹ ìì±ëª
ì í´ë¹ ìì±ê°ì¼ë¡ ì¢
ë£íë ìì를 ì í165    166    ////// íì´ì§ 구ì±í기 /////167    //#1. ëªê°ë¥¼ íëì íì´ì ë§ë¤ ìíì ë³´ì¬ì¤ ê²ì¸ê°? <ol> íê·¸ ìëì ì¡´ì¬íë <li>를 ìíì ê°ìì ë§ì¶ì´ì ë£ì´ì¤168    var $ea_item = 4; //ê° íì´ì§ë³ë¡ 4ê°ì ìíì ë³´ì¬ì£¼ê² ë¤ê³  ì ì¸169    //18ê°ì ìíì´ ì¡´ì¬íë¤ë©´ (1,2,3,4) / (5,6,7,8) / (9,10,11,12) / (13,14,15,16) / (17, 18)170    function view_default(){171        172    173        if($pd_arr.length % $ea_item == 0){ //ì ì²´ ìíì ê°ìë 4ì ë°°ìë¤. ë§ì½, 16ê°ì ìíì´ ì¡´ì¬íë¤ë©´174            //liì ê°ì를 ìíì ê°ë³ íì´ì§ë§ë¤ ë³´ì¬ì¤ ìì ì¼ì¹175            for(k = 0; k < $pd_arr/$ea_item; k++){ //k<4 ... k = 0 -> 1 -> 2 -> 3176                $(".pager").append("<li>"+(k+1)+"</li>");177            }178        }else{ //ì ì²´ ìíì ê°ìë 4ì ë°°ìê° ìëë¤.179            for(k = 0; k < $pd_arr.length/$ea_item; k++){ //k<=4.5 ... k = 0 -> 1 -> 2 -> 3 -> 4180                $(".pager").append("<li>"+(k+1)+"</li>");181            }182        }183        //ì´ê¸° 구ì±(liì íì¬ íì´ì§ë¥¼ ì려주ë íì±í ìí + í´ë¹íë íì´ì§ì ë´ì©ë§ ì ì¸íê³  ëª¨ë  ê²ì ê°ì¶ë¤.)184        //ì¸ë±ì¤ ë²í¸185        /*186        [í íì´ì§ë§ë¤ 4ê°ì© ë³´ì¬ì¤ ê²½ì°]187        (0, 1, 2, 3)188        (4, 5, 6, 7)189        (8, 9, 10, 11)190        (12, 13, 14, 15)191        (16, 17) 192        [í íì´ì§ë§ë¤ 8ê°ì© ë³´ì¬ì¤ ê²½ì°]193        (0, 1, 2, 3, 4, 5, 6, 7)194        (8, 9, 10, 11, 12, 13, 14, 15)195        (16, 17)196        */197        $(".pd_box").show();198        $(".pager li").eq(0).addClass("active");199        $(".pd_box").eq($ea_item - 1).nextAll().hide();200    };201    view_default(); //ë¸ë¼ì°ì  ë¡ë©í í¨ì구문 í¸ì¶íì¬ ì´ê¸°ê°ì ì¸í
202    $(".ea_btn").click(function(){203        $ea_item = $(this).attr("rel");204        console.log($ea_item);205        $(".pager").empty();206        $(".ea_btn").removeClass("active");207        $(this).addClass("active");208        view_default(); //ê°ì 보기를 í´ë¦íì ë í¨ì를 í¸ì¶íë¤.209    });210    //íì´ì ë¥¼ í´ë¦íì ë í´ë¹íë íì´ì ë¡ ê´ë ¨ ìíë§ ë³´ì¬ì¤ë¤. ì¸ë±ì¤ë²í¸ì ë§ì¶°ì ëíëê² íë¤.211    /*212    ol>li 0ë² ì¸ë±ì¤ë¥¼ í´ë¦ì : 0,1,2,3       0(ì¸ë±ì¤ë²í¸) * $ea_item  ~  ((0 + 1) * $ea_item) - 1213    ol>li 1ë² ì¸ë±ì¤ë¥¼ í´ë¦ì : 4,5,6,7       1(ì¸ë±ì¤ë²í¸) * $ea_item  ~  ((1 + 1) * $ea_item) - 1214    ol>li 2ë² ì¸ë±ì¤ë¥¼ í´ë¦ì : 8,9,10,11     2(ì¸ë±ì¤ë²í¸) * $ea_item  ~  ((2 + 1) * $ea_item) - 1215    ol>li 3ë² ì¸ë±ì¤ë¥¼ í´ë¦ì : 12,13,14,15   3(ì¸ë±ì¤ë²í¸) * $ea_item  ~  ((3 + 1) * $ea_item) - 1216    */217    $(document).on("click", ".pager li", function(){218        //console.log("í´ë¦ ì´ë²¤í¸ ë°ì")219        var $pager_index = $(this).index();220        console.log($pager_index);221        $(".pd_box").show();222        //ë³´ì¬ì¤ íë©´223        //ê° íì´ì§ì 첫ë²ì§¸ ì¸ë±ì¤ ì´ì ì ëª¨ë  íì ë¤ì ë³´ì´ì§ ìëë¡ ì²ë¦¬224        $(".pd_box").eq($pager_index * $ea_item).prevAll().hide();225        //ê° íì´ì§ì ë§ì§ë§ ì¸ë±ì¤ ì´íì ëª¨ë  íì ë¤ì ë³´ì´ì§ ìëë¡ ì²ë¦¬226        $(".pd_box").eq((($pager_index + 1) * $ea_item) - 1).nextAll().hide();227        $(".pager li").removeClass("active");228        $(this).addClass("active");229    });...iframe_alter_product.js
Source:iframe_alter_product.js  
1/* global shoproot */2/**3 * ååç¼è¾4 * @description Hope You Do Good But Not Evil5 * @copyright   Copyright 2014-2015 <ycchen@iwshop.cn>6 * @license     LGPL (http://www.gnu.org/licenses/lgpl.html)7 * @author      Chenyong Cai <ycchen@iwshop.cn>8 * @package     Wshop9 * @link        http://www.iwshop.cn10 */11requirejs(['util', 'fancyBox', 'ueditor', 'jUploader'], function (util, fancyBox, ueditor, jUploader) {12    // ååå¾çå表13    var pdImages = ['', '', '', '', ''];14    // ååid15    var pdId = false;16    // ååå¾ç宽度17    var pdImageWidth = false;18    // ajaxé19    var loadingLock = false;20    var pdCatimg = false;21    var entDiscount = [];22    var entDisLastOpt;23    fnFancyBox('#catimgPv');24    fnFancyBox('.pd-image-view');25    fnFancyBox('#fetch_product_btn');//æåæ°æ®æé®fancybox26    // 产åé¦å¾27    pdCatimg = $('#pd-catimg').val() === '' ? false : $('#pd-catimg').val();28    if ($('#mod').val() === 'edit') {29        // ç¼è¾æ¨¡å¼ åå
¥å¾çå表30        $('.pd-images').each(function (i, node) {31            if ($(node).val() && $(node).val() !== '' && i < 5) {32                pdImages[$(node).attr('data-sort')] = $(node).val();33                $('.pd-image-sec').eq(parseInt($(node).attr('data-sort')) + 1).append('<img src="' + $(node).val() + '" width="' + pdImageWidth + 'px" /><a href="' + $(node).val() + '" class="pd-image-view"> </a><i data-id=' + $(node).attr('data-sort') + ' class="pd-image-delete"> </i>').addClass('ove');34            }35        });36        fnPdimageDelete();37        // ååç¼å·38        pdId = parseInt($('#pid').val());39        fnFancyBox('.pd-image-view');40    } else {41        // æ°å»ºæ¨¡å¼42        pdId = false;43    }44    // 产ååç±»45    var pdCatSelect = $("#pd-catselect").find("option[value='" + $('#pd-form-cat').val() + "']");46    if (pdCatSelect.get(0) !== undefined) {47        pdCatSelect.get(0).selected = true;48    }49    // 产åç§æ50    $('#pd-prom').on('change', function () {51        if (parseInt($(this).val()) === 1) {52            $('#prom_option').removeClass('hidden');53        } else {54            $('#prom_option').addClass('hidden');55        }56    });57    // é墿æ£58    $('.product-ent-discount').each(function (i, node) {59        if (i === 0) {60            $('#pd-ent-discount').val(parseFloat($(this).attr('data-discount')));61            entDisLastOpt = $(this);62        }63        entDiscount.push({64            ent: parseInt($(this).val()),65            discount: parseFloat($(this).attr('data-discount'))66        });67    });68    // 产åå¾ç69    $('.pd-image-sec').each(function () {70        var btn = this;71        // å¾çä¸ä¼ æä»¶72        $.jUploader({73            button: $(btn),74            action: '?/wImages/ImageUpload/',75            onUpload: function (fileName) {76                util.Alert('å¾çä¸ä¼ ä¸');77            },78            onComplete: function (fileName, response) {79                var Btn = $(this.button[0]);80                if (response.ret_code == 0) {81                    var iid = parseInt(Btn.attr('data-id'));82                    var src = decodeURIComponent(response.link);83                    Btn.addClass('ove').removeClass('hover');84                    util.Alert('å¾çä¸ä¼ æå');85                    if (Btn.find('img').length > 0) {86                        Btn.find('img').attr('src', response.ret_msg);87                        Btn.find('.pd-image-view').attr('href', response.ret_msg);88                    } else {89                        Btn.append('<img src="' + response.ret_msg + '" /><a href="' + response.ret_msg + '" class="pd-image-view"> </a><i data-id=' + (iid - 1) + ' class="pd-image-delete"> </i>');90                    }91                    // ååé¦å¾92                    if (!pdCatimg || iid === 0) {93                        $('#pd-catimg').val(response.ret_msg);94                        $('#catimgPv').attr('href', response.ret_msg);95                    }96                    if (iid !== 0) {97                        pdImages[iid - 1] = response.ret_msg;98                    }99                    fnFancyBox('.pd-image-view');100                    fnPdimageDelete();101                } else {102                    util.Alert('ä¸ä¼ å¾ç失败');103                }104            }105        });106        $(this).hover(function () {107            if (!$(this).hasClass('ove')) {108                $(this).addClass('hover');109            }110        }, function () {111            if (!$(this).hasClass('ove')) {112                $(this).removeClass('hover');113            }114        });115    });116    // 产åé¦å¾117    if (pdCatimg) {118        $('.pd-image-sec').eq(0).addClass('ove').append('<img src="' + pdCatimg + '" />');119        $('#catimgPv').attr('href', pdCatimg);120    }121    $('body').css('overflow-x', 'hidden');122    // å¾çå·²ç»ä¸ä¼ è¿äºã123    $('#save_product_btn').unbind('click').click(__ProductAlterFinish);124    // å é¤å¾ç--125    function fnPdimageDelete() {126        $('.pd-image-delete').unbind('click').on('click', function () {127            var nP = $(this).parent();128            // å é¤å¾éæ°æ®129            pdImages[parseInt($(this).attr('data-id'))] = '';130            // å é¤æ è®°131            nP.removeClass('ove').find('i,img,.pd-image-view').remove();132            nP = null;133        });134    }135    /**136     * ååç¼è¾ç»æ137     * @returns {undefined}138     */139    function __ProductAlterFinish() {140        if (!loadingLock) {141            // discount142            entDisLastOpt = $('#pd-entprise').find("option:selected");143            $.each(entDiscount, function (i, n) {144                if (n.ent === parseInt(entDisLastOpt.val())) {145                    n.discount = parseFloat($('#pd-ent-discount').val());146                }147            });148            var postData = $('#pd-baseinfo').serializeArray();149            var price = parseFloat($('#pd-form-prices').val());150            // è§æ ¼è¡¨æ£æ¥ èªå¨è¡¥0151            fnSpecCheck();152            util.loading();153            if ($('#pd-form-title').val() !== '' && price !== '') {154                loadingLock = true;155                // [HttpPost]156                $.post(shoproot + '?/WdminAjax/updateProduct', {157                    product_id: !pdId ? 0 : pdId,158                    product_infos: postData,159                    product_prices: price > 0 ? price : 0,160                    product_images: pdImages,161                    entDiscount: entDiscount,162                    spec: getSpecs()163                }, function (r) {164                    util.loading(false);165                    if (r.ret_code === 0) {166                        loadingLock = false;167                        if (!pdId) {168                            pdId = r.ret_msg;169                            util.Alert('æ·»å æå', false, function () {170                                // è¿åå表171                                history.go(-1);172                            });173                        } else {174                            pdId = r.ret_msg;175                            util.Alert('ä¿åæå');176                        }177                    } else {178                        util.Alert('ä¿å失败,é误信æ¯ï¼' + r.ret_msg);179                    }180                });181            } else {182                util.Alert('æ æ³æäº¤ï¼è¡¨åä¸å®æ´ã');183            }184        } else {185        }186    }187    /**188     * ååå é¤çå¬189     */190    util.pdDeleteListen();191    // ååè§æ ¼æ·»å æé®192    $('#pd-spec-add').click(function () {193        $('#pd-spec-frame').removeClass('hidden').css('margin-top', '15px');194        var tr = $('.specselect').eq(0).clone(false);195        tr.find('select option:selected').each(function () {196            this.selected = false;197        });198        tr.find('input').val(0);199        tr.attr('data-id', 0);200        tr.removeClass('hidden');201        $('#pd-spec-frame tbody').append(tr);202        fnSpecListen();203        tr = null;204    });205    /**206     * è·ååå价格表207     * @returns {Array}208     */209    function getSpecs() {210        var spec = [];211        $('.specselect').each(function () {212            if ($(this).attr('data-id') !== '#') {213                spec.push({214                    id: $(this).attr('data-id'),215                    sid: $(this).find('.spec1').val() + '-' + $(this).find('.spec2').val(),216                    price: parseFloat($(this).find('.pd-spec-prices').val()),217                    market_price: parseFloat($(this).find('.pd-spec-market').val()),218                    instock: parseFloat($(this).find('.pd-spec-stock').val())219                });220            }221        });222        return spec;223    }224    /**225     * è§æ ¼è¡¨èªå¨è¡¥0226     * @returns {undefined}227     */228    function fnSpecCheck() {229        $('.specselect input').each(function () {230            if ($(this).val() === '') {231                $(this).val(0);232            }233        });234    }235    // åå§å236    fnSpecCheck();237    fnSpecListen();238    /**239     * è§æ ¼è¡¨äºä»¶çå¬240     * @returns {undefined}241     */242    function fnSpecListen() {243        $('.btn-delete-spectr').unbind('click').bind('click', function () {244            var nParent = $(this).parents('tr');245            if (nParent.attr('data-id') > 0) {246                // èµå¼è´æ°è¡¨ç¤ºå é¤247                nParent.attr('data-id', nParent.attr('data-id') * -1);248                nParent.addClass('hidden');249            } else {250                // å¦åç´æ¥å é¤èç¹, ä¸ç¶ä¼ææ ææ°æ®251                nParent.remove();252            }253        });254        $('.spec1').unbind('change').bind('change', fnSpecChange);255        $('.spec1').change();256    }257    /**258     * è§æ ¼éæ©çå¬259     * @returns {undefined}260     */261    function fnSpecChange() {262        // é¿å
éå¤éæ©è§æ ¼263        var specId = +$(this).find('option:selected').attr('data-spec');264        $(this).parents('tr').eq(0).find('.spec2 option').each(function () {265            if (+$(this).attr('data-spec') === specId) {266                // 夿ç¶çº§267                this.disabled = true;268            } else {269                this.disabled = false;270            }271        });272    }273    /**274     * ueditor275     */276    uep = UM.getEditor('ueditorp', {277        autoHeight: true278    });279    uep.ready(function () {280        ueploaded = true;281        uep.setWidth("100%");282    });283    /**284     * window resize çå¬285     */286    util.onresize(function () {287        var _h = $('.pd-image-sec.ps20').eq(0).width();288        $('.pd-image-sec').each(function () {289            if ($(this).hasClass('ps20')) {290                $(this).height(_h);291            } else {292                $(this).height($(this).width());293            }294        });295        uep.setWidth("100%");296    });...15.2.3.3-01.js
Source:15.2.3.3-01.js  
1/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */2/* This Source Code Form is subject to the terms of the Mozilla Public3 * License, v. 2.0. If a copy of the MPL was not distributed with this4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */5//-----------------------------------------------------------------------------6var BUGNUMBER = 505587;7var summary = 'ES5 Object.getOwnPropertyDescriptor(O)';8var actual = '';9var expect = '';10printBugNumber(BUGNUMBER);11printStatus (summary);12/**************13 * BEGIN TEST *14 **************/15function assertEq(a, e, msg)16{17  function SameValue(v1, v2)18  {19    if (v1 === 0 && v2 === 0)20      return 1 / v1 === 1 / v2;21    if (v1 !== v1 && v2 !== v2)22      return true;23    return v1 === v2;24  }25  if (!SameValue(a, e))26  {27    var stack = new Error().stack || "";28    throw "Assertion failed: got " + a + ", expected " + e +29          (msg ? ": " + msg : "") +30          (stack ? "\nStack:\n" + stack : "");31  }32}33function expectDescriptor(actual, expected)34{35  if (actual === undefined && expected === undefined)36    return;37  assertEq(typeof actual, "object");38  assertEq(typeof expected, "object");39  var fields =40    {41      value: true,42      get: true,43      set: true,44      enumerable: true,45      writable: true,46      configurable: true47    };48  for (var p in fields)49    assertEq(actual.hasOwnProperty(p), expected.hasOwnProperty(p), p);50  for (var p in actual)51    assertEq(p in fields, true, p);52  for (var p in expected)53    assertEq(p in fields, true, p);54  assertEq(actual.hasOwnProperty("value"), actual.hasOwnProperty("writable"));55  assertEq(actual.hasOwnProperty("get"), actual.hasOwnProperty("set"));56  if (actual.hasOwnProperty("value"))57  {58    assertEq(actual.value, expected.value);59    assertEq(actual.writable, expected.writable);60  }61  else62  {63    assertEq(actual.get, expected.get);64    assertEq(actual.set, expected.set);65  }66  assertEq(actual.hasOwnProperty("enumerable"), true);67  assertEq(actual.hasOwnProperty("configurable"), true);68  assertEq(actual.enumerable, expected.enumerable);69  assertEq(actual.configurable, expected.configurable);70}71function adjustDescriptorField(o, actual, expect, field)72{73  assertEq(field === "get" || field === "set", true);74  var lookup = "__lookup" + (field === "get" ? "G" : "S") + "etter";75  if (typeof o[lookup] === "function")76    expect[field] = o[lookup](field);77  else78    actual[field] = expect[field] = undefined; /* censor if we can't lookup */79}80/******************************************************************************/81var o, pd, expected;82o = { get x() { return 12; } };83pd = Object.getOwnPropertyDescriptor(o, "x");84expected =85  {86    set: undefined,87    enumerable: true,88    configurable: true89  };90adjustDescriptorField(o, pd, expected, "get");91expectDescriptor(pd, expected);92/******************************************************************************/93var o2;94o = Object.create(Object.prototype, { x: {get: function () { return 12; } } });95pd = Object.getOwnPropertyDescriptor(o, "x");96expected =97  {98    set: undefined,99    enumerable: false,100    configurable: false101  };102adjustDescriptorField(o, pd, expected, "get");103expectDescriptor(pd, expected);104o2 = Object.create(o);105assertEq(Object.getOwnPropertyDescriptor(o2, "x"), undefined);106/******************************************************************************/107o = {};108o.b = 12;109pd = Object.getOwnPropertyDescriptor(o, "b");110expected =111  {112    value: 12,113    writable: true,114    enumerable: true,115    configurable: true116  };117expectDescriptor(pd, expected);118/******************************************************************************/119o = { get y() { return 17; }, set y(z) { } };120pd = Object.getOwnPropertyDescriptor(o, "y");121expected =122  {123    enumerable: true,124    configurable: true125  };126adjustDescriptorField(o, pd, expected, "get");127adjustDescriptorField(o, pd, expected, "set");128expectDescriptor(pd, expected);129/******************************************************************************/130o = {};131pd = Object.getOwnPropertyDescriptor(o, "absent");132expectDescriptor(pd, undefined);133/******************************************************************************/134pd = Object.getOwnPropertyDescriptor([], "length");135expected =136  {137    value: 0,138    writable: true,139    enumerable: false,140    configurable: false141  };142expectDescriptor(pd, expected);143pd = Object.getOwnPropertyDescriptor([1], "length");144expected =145  {146    value: 1,147    writable: true,148    enumerable: false,149    configurable: false150  };151expectDescriptor(pd, expected);152pd = Object.getOwnPropertyDescriptor([1,], "length");153expected =154  {155    value: 1,156    writable: true,157    enumerable: false,158    configurable: false159  };160expectDescriptor(pd, expected);161pd = Object.getOwnPropertyDescriptor([1,,], "length");162expected =163  {164    value: 2,165    writable: true,166    enumerable: false,167    configurable: false168  };169expectDescriptor(pd, expected);170/******************************************************************************/171pd = Object.getOwnPropertyDescriptor(new String("foobar"), "length");172expected =173  {174    value: 6,175    writable: false,176    enumerable: false,177    configurable: false178  };179expectDescriptor(pd, expected);180/******************************************************************************/181function foo() { }182o = foo;183pd = Object.getOwnPropertyDescriptor(o, "length");184expected =185  {186    value: 0,187    writable: false,188    enumerable: false,189    configurable: true190  };191expectDescriptor(pd, expected);192pd = Object.getOwnPropertyDescriptor(o, "prototype");193expected =194  {195    value: foo.prototype,196    writable: true,197    enumerable: false,198    configurable: false199  };200expectDescriptor(pd, expected);201/******************************************************************************/202pd = Object.getOwnPropertyDescriptor(Function, "length");203expected =204  {205    value: 1,206    writable: false,207    enumerable: false,208    configurable: true209  };210expectDescriptor(pd, expected);211/******************************************************************************/212o = /foo/im;213pd = Object.getOwnPropertyDescriptor(o, "lastIndex");214expected =215  {216    value: 0,217    writable: true,218    enumerable: false,219    configurable: false220  };221expectDescriptor(pd, expected);222/******************************************************************************/223reportCompare(expect, actual, "Object.getOwnPropertyDescriptor");...pdlist.js
Source:pdlist.js  
1const pdlist = [2  {3    'id': 1,4    'pdImg': './static/mock/img/pd1.jpg',5    'pdName': 'ã1ã  å
ç½è£
è·å
°ç¾ç´ ä½³å¿éè£
2段900g',6    'pdPrice': 1149.00,7    'pdSold': 6488  }, {9    'id': 2,10    'pdImg': './static/mock/img/pd2.jpg',11    'pdName': 'ã2ã  é©å½Amoreç±èèçº¢åæ´åæ°´å¥è£
ä¿®å¤åæåè´¨',12    'pdPrice': 89.00,13    'pdSold': 12814  }, {15    'id': 3,16    'pdImg': './static/mock/img/pd3.jpg',17    'pdName': 'ã3ã  Frisoç¾ç´ ä½³å¿ éè£
å©´å¿é
æ¹å¥¶ç²3段900g',18    'pdPrice': 195.00,19    'pdSold': 96820  }, {21    'id': 4,22    'pdImg': './static/mock/img/pd4.jpg',23    'pdName': 'ã4ã  Fisher pdPriceè´¹éª è´¹éªä¸è½®å¿ç«¥æ»è¡è½¦',24    'pdPrice': 299.00,25    'pdSold': 8526  }, {27    'id': 5,28    'pdImg': './static/mock/img/pd5.jpg',29    'pdName': 'ã5ã  Babyleeå·´å¸å 宿¨å©´å¿åº é·å¡æ130*70cm',30    'pdPrice': 1889.00,31    'pdSold': 1832  }, {33    'id': 6,34    'pdImg': './static/mock/img/pd6.jpg',35    'pdName': 'ã6ã  Pigeonè´äº² ç¬ç«ä¸å±å¥¶ç²ç éå°ç½å¥¶ç²1段200g',36    'pdPrice': 70.00,37    'pdSold': 65838  }, {39    'id': 7,40    'pdImg': './static/mock/img/pd7.jpg',41    'pdName': 'ã7ã TTBOOå
å
å°å¸ è©çº½æ£å¥è£
',42    'pdPrice': 268.00,43    'pdSold': 12844  }, {45    'id': 8,46    'pdImg': './static/mock/img/pd8.jpg',47    'pdName': 'ã8ã  Nunaçæ å©´å¿å¸éå¥æç²¾çº¯å«©è¤æ²æµ´é²å©´å¿ç²¾çº¯è¦èè¶',48    'pdPrice': 140.00,49    'pdSold': 36650  }, {51    'id': 9,52    'pdImg': './static/mock/img/pd9.jpg',53    'pdName': 'ã9ã  illumaå¯èµ 奶ç²3段900g',54    'pdPrice': 252.00,55    'pdSold': 9856  }, {57    'id': 10,58    'pdImg': './static/mock/img/pd10.jpg',59    'pdName': 'ã10ã  Abbotté
å¹ä¹³èç½é¨å水解婴å¿é
æ¹å¥¶ç²3段820g',60    'pdPrice': 89.00,61    'pdSold': 12862  }, {63    'id': 11,64    'pdImg': './static/mock/img/pd11.jpg',65    'pdName': 'ã11ã  é©è é
·ç«åèï¼ç¤¼çå¥è£
ï¼2.8g*4',66    'pdPrice': 179.00,67    'pdSold': 3568  }, {69    'id': 12,70    'pdImg': './static/mock/img/pd12.jpg',71    'pdName': 'ã12ã  ä¿ç¨åºç´åã3å
è£
ãæ¥æ¬Merriesè±ç纸尿裤NB90',72    'pdPrice': 289.00,73    'pdSold': 192874  }, {75    'id': 13,76    'pdImg': './static/mock/img/pd13.jpg',77    'pdName': 'ã13ã  Comotomoå¯ä¹å¤ä¹ ç¡
è¶å¥¶ç¶ï¼0-3æå¥¶å´ï¼150ml绿è²',78    'pdPrice': 203.00,79    'pdSold': 8780  }, {81    'id': 14,82    'pdImg': './static/mock/img/pd14.jpg',83    'pdName': 'ã14ã  é¦æ¸¯ç´é®å¾·å½çå¾·é²Rival de Loopè¦èç²¾åå®ç¶',84    'pdPrice': 152.00,85    'pdSold': 6186  }, {87    'id': 15,88    'pdImg': './static/mock/img/pd15.jpg',89    'pdName': 'ã15ã  ä¿ç¨åºç´åè¯å¸å å°é©¬æ²¹é¦è峿¸©åä¿æ¹¿æ åºæ¿é¢é',90    'pdPrice': 269.00,91    'pdSold': 7392  }, {93    'id': 16,94    'pdImg': './static/mock/img/pd16.jpg',95    'pdName': 'ã16ã  é¦æ¸¯ç´é®æ¥æ¬Spatreatmentç¼èä¿æ¹¿å»ç»çº¹æ³ä»¤çº¹',96    'pdPrice': 219.00,97    'pdSold': 1398  }, {99    'id': 17,100    'pdImg': './static/mock/img/pd17.jpg',101    'pdName': 'ã17ã  é©å½MEDIHEALNMFå¯è±ä¸éåç¡ç é¢è',102    'pdPrice': 81.00,103    'pdSold': 128104  }, {105    'id': 18,106    'pdImg': './static/mock/img/pd18.jpg',107    'pdName': 'ã18ã  DHCè¶ç¿ è¯æ©æ¦èèæ»å
»æ´è¸æå·¥ç90g',108    'pdPrice': 123.00,109    'pdSold': 77110  }, {111    'id': 19,112    'pdImg': './static/mock/img/pd19.jpg',113    'pdName': 'ã19ã  æ¥æ¬èµçå CPBèè¤ä¹é¥æ°çéç¦»é æ¸
ç½å 30ml',114    'pdPrice': 429.00,115    'pdSold': 36116  }, {117    'id': 20,118    'pdImg': './static/mock/img/pd20.jpg',119    'pdName': 'ã20ã Heinzäº¨æ° å©´å¿é¢æ¡ä¼å é¢æ¡å
¨ç´ å¥é¤ç»å3å£å³3ç',120    'pdPrice': 39.00,121    'pdSold': 61122  }, {123    'id': 21,124    'pdImg': './static/mock/img/pd21.jpg',125    'pdName': 'ã21ã  Heinzäº¨æ° ä¹ç»´æ»ææ±æ³¥ç»å5å£å³15è¢',126    'pdPrice': 69.00,127    'pdSold': 55128  }, {129    'id': 22,130    'pdImg': './static/mock/img/pd22.jpg',131    'pdName': 'ã22ã  ä¿ç¨åºç´å澳大å©äºSwisse髿µåº¦èè¶èè¶å30ç²',132    'pdPrice': 271.00,133    'pdSold': 19134  }, {135    'id': 23,136    'pdImg': './static/mock/img/pd23.jpg',137    'pdName': 'ã23ã  æªå¨Nordic Naturalså°é±¼å©´å¹¼å¿é±¼æ²¹DHAæ»´å',138    'pdPrice': 102.00,139    'pdSold': 125140  }, {141    'id': 24,142    'pdImg': './static/mock/img/pd24.jpg',143    'pdName': 'ã24ã  æ¾³å¤§å©äºBio island DHA for Pregnancyæµ·è»æ²¹DHA',144    'pdPrice': 289.00,145    'pdSold': 28146  }, {147    'id': 25,148    'pdImg': './static/mock/img/pd25.jpg',149    'pdName': 'ã25ã  æ¾³å¤§å©äºFatblaster Coconut Detoxæ¤°åæ°´',150    'pdPrice': 152.00,151    'pdSold': 17152  }, {153    'id': 26,154    'pdImg': './static/mock/img/pd26.jpg',155    'pdName': 'ã26ã  Suitskyèæ¯å¥ é«æ¤æèèç½çº¸å°¿çå°¿ä¸æ¹¿XL60',156    'pdPrice': 99.00,157    'pdSold': 181158  }, {159    'id': 27,160    'pdImg': './static/mock/img/pd27.jpg',161    'pdName': 'ã27ã  è±å½JUST SOAPæå·¥ç ç«ç°å¤©ç«ºèµèç³ç',162    'pdPrice': 72.00,163    'pdSold': 66164  }, {165    'id': 28,166    'pdImg': './static/mock/img/pd28.jpg',167    'pdName': 'ã28ã  å¾·å½NUK å¤è²å©´å¹¼å¿å¸¦çå¦é¥®æ¯',168    'pdPrice': 92.00,169    'pdSold': 138170  }171]...pdlist1.js
Source:pdlist1.js  
1var pdlist1=[2	{3		"pdImg": "../res/img/pd1.jpg",4		"pdName": "ã1ã  å
ç½è£
è·å
°ç¾ç´ ä½³å¿éè£
2段900g",5		"pdPrice": 1149.00,6		"pdSold": 6487	}, {8		"pdImg": "../res/img/pd2.jpg",9		"pdName": "ã2ã  é©å½Amoreç±èèçº¢åæ´åæ°´å¥è£
ä¿®å¤åæåè´¨",10		"pdPrice": 89.00,11		"pdSold": 12812	}, {13		"pdImg": "../res/img/pd3.jpg",14		"pdName": "ã3ã  Frisoç¾ç´ ä½³å¿ éè£
å©´å¿é
æ¹å¥¶ç²3段900g",15		"pdPrice": 195.00,16		"pdSold": 96817	}, {18		"pdImg": "../res/img/pd4.jpg",19		"pdName": "ã4ã  Fisher pdPriceè´¹éª è´¹éªä¸è½®å¿ç«¥æ»è¡è½¦",20		"pdPrice": 299.00,21		"pdSold": 8522	}, {23		"pdImg": "../res/img/pd5.jpg",24		"pdName": "ã5ã  Babyleeå·´å¸å 宿¨å©´å¿åº é·å¡æ130*70cm",25		"pdPrice": 1889.00,26		"pdSold": 1827	}, {28		"pdImg": "../res/img/pd6.jpg",29		"pdName": "ã6ã  Pigeonè´äº² ç¬ç«ä¸å±å¥¶ç²ç éå°ç½å¥¶ç²1段200g",30		"pdPrice": 70.00,31		"pdSold": 65832	}, {33		"pdImg": "../res/img/pd7.jpg",34		"pdName": "ã7ã TTBOOå
å
å°å¸ è©çº½æ£å¥è£
",35		"pdPrice": 268.00,36		"pdSold": 12837	}, {38		"pdImg": "../res/img/pd8.jpg",39		"pdName": "ã8ã  Nunaçæ å©´å¿å¸éå¥æç²¾çº¯å«©è¤æ²æµ´é²å©´å¿ç²¾çº¯è¦èè¶",40		"pdPrice": 140.00,41		"pdSold": 36642	}, {43		"pdImg": "../res/img/pd9.jpg",44		"pdName": "ã9ã  illumaå¯èµ 奶ç²3段900g",45		"pdPrice": 252.00,46		"pdSold": 9847	}, {48		"pdImg": "../res/img/pd10.jpg",49		"pdName": "ã10ã  Abbotté
å¹ä¹³èç½é¨å水解婴å¿é
æ¹å¥¶ç²3段820g",50		"pdPrice": 89.00,51		"pdSold": 12852	}, {53		"pdImg": "../res/img/pd11.jpg",54		"pdName": "ã11ã  é©è é
·ç«åèï¼ç¤¼çå¥è£
ï¼2.8g*4",55		"pdPrice": 179.00,56		"pdSold": 3557	}, {58		"pdImg": "../res/img/pd12.jpg",59		"pdName": "ã12ã  ä¿ç¨åºç´åã3å
è£
ãæ¥æ¬Merriesè±ç纸尿裤NB90",60		"pdPrice": 289.00,61		"pdSold": 192862	}, {63		"pdImg": "../res/img/pd13.jpg",64		"pdName": "ã13ã  Comotomoå¯ä¹å¤ä¹ ç¡
è¶å¥¶ç¶ï¼0-3æå¥¶å´ï¼150ml绿è²",65		"pdPrice": 203.00,66		"pdSold": 8767	}, {68		"pdImg": "../res/img/pd14.jpg",69		"pdName": "ã14ã  é¦æ¸¯ç´é®å¾·å½çå¾·é²Rival de Loopè¦èç²¾åå®ç¶",70		"pdPrice": 152.00,71		"pdSold": 6172	}, {73		"pdImg": "../res/img/pd15.jpg",74		"pdName": "ã15ã  ä¿ç¨åºç´åè¯å¸å å°é©¬æ²¹é¦è峿¸©åä¿æ¹¿æ åºæ¿é¢é",75		"pdPrice": 269.00,76		"pdSold": 7377	}, {78		"pdImg": "../res/img/pd16.jpg",79		"pdName": "ã16ã  é¦æ¸¯ç´é®æ¥æ¬Spatreatmentç¼èä¿æ¹¿å»ç»çº¹æ³ä»¤çº¹",80		"pdPrice": 219.00,81		"pdSold": 1382	}, {83		"pdImg": "../res/img/pd17.jpg",84		"pdName": "ã17ã  é©å½MEDIHEALNMFå¯è±ä¸éåç¡ç é¢è",85		"pdPrice": 81.00,86		"pdSold": 12887	}, {88		"pdImg": "../res/img/pd18.jpg",89		"pdName": "ã18ã  DHCè¶ç¿ è¯æ©æ¦èèæ»å
»æ´è¸æå·¥ç90g",90		"pdPrice": 123.00,91		"pdSold": 7792	}, {93		"pdImg": "../res/img/pd19.jpg",94		"pdName": "ã19ã  æ¥æ¬èµçå CPBèè¤ä¹é¥æ°çéç¦»é æ¸
ç½å 30ml",95		"pdPrice": 429.00,96		"pdSold": 3697	}, {98		"pdImg": "../res/img/pd20.jpg",99		"pdName": "ã20ã Heinzäº¨æ° å©´å¿é¢æ¡ä¼å é¢æ¡å
¨ç´ å¥é¤ç»å3å£å³3ç",100		"pdPrice": 39.00,101		"pdSold": 61102	}, {103		"pdImg": "../res/img/pd21.jpg",104		"pdName": "ã21ã  Heinzäº¨æ° ä¹ç»´æ»ææ±æ³¥ç»å5å£å³15è¢",105		"pdPrice": 69.00,106		"pdSold": 55107	}, {108		"pdImg": "../res/img/pd22.jpg",109		"pdName": "ã22ã  ä¿ç¨åºç´å澳大å©äºSwisse髿µåº¦èè¶èè¶å30ç²",110		"pdPrice": 271.00,111		"pdSold": 19112	}, {113		"pdImg": "../res/img/pd23.jpg",114		"pdName": "ã23ã  æªå¨Nordic Naturalså°é±¼å©´å¹¼å¿é±¼æ²¹DHAæ»´å",115		"pdPrice": 102.00,116		"pdSold": 125117	}, {118		"pdImg": "../res/img/pd24.jpg",119		"pdName": "ã24ã  æ¾³å¤§å©äºBio island DHA for Pregnancyæµ·è»æ²¹DHA",120		"pdPrice": 289.00,121		"pdSold": 28122	}, {123		"pdImg": "../res/img/pd25.jpg",124		"pdName": "ã25ã  æ¾³å¤§å©äºFatblaster Coconut Detoxæ¤°åæ°´",125		"pdPrice": 152.00,126		"pdSold": 17127	}, {128		"pdImg": "../res/img/pd26.jpg",129		"pdName": "ã26ã  Suitskyèæ¯å¥ é«æ¤æèèç½çº¸å°¿çå°¿ä¸æ¹¿XL60",130		"pdPrice": 99.00,131		"pdSold": 181132	}, {133		"pdImg": "../res/img/pd27.jpg",134		"pdName": "ã27ã  è±å½JUST SOAPæå·¥ç ç«ç°å¤©ç«ºèµèç³ç",135		"pdPrice": 72.00,136		"pdSold": 66137	}, {138		"pdImg": "../res/img/pd28.jpg",139		"pdName": "ã28ã  å¾·å½NUK å¤è²å©´å¹¼å¿å¸¦çå¦é¥®æ¯",140		"pdPrice": 92.00,141		"pdSold": 138142	}...pdlist2.js
Source:pdlist2.js  
1var pdlist2=[2	{3		"pdImg": "../res/img/pd3.jpg",4		"pdName": "ã3ã ç¾ç´ ä½³å¿Frisoå©´å¿é
æ¹å¥¶ç²3段 ( ååã1ãã2ã å·²å é¤ )",5		"pdPrice": 177.00,6		"pdSold": 10237	}, {8		"pdImg": "../res/img/pd4.jpg",9		"pdName": "ã4ã æ¯äººéè´1è¾ è´¹éªæ»è¡è½¦",10		"pdPrice": 189.00,11		"pdSold": 19912	}, {13		"pdImg": "../res/img/pd5.jpg",14		"pdName": "ã5ã  å·´å¸å宿¨å©´å¿åº",15		"pdPrice": 1800.00,16		"pdSold": 7217	}, {18		"pdImg": "../res/img/pd6.jpg",19		"pdName": "ã6ã  è´äº²å¥¶ç²ç",20		"pdPrice": 98.00,21		"pdSold": 67722	}, {23		"pdImg": "../res/img/pd7.jpg",24		"pdName": "ã7ã å
å
å°å¸è©çº½æ£å¥è£
",25		"pdPrice": 277.00,26		"pdSold": 16627	}, {28		"pdImg": "../res/img/pd8.jpg",29		"pdName": "ã8ã  çæå©´å¿æ²æµ´é²",30		"pdPrice": 155.00,31		"pdSold": 34332	}, {33		"pdImg": "../res/img/pd9.jpg",34		"pdName": "ã9ã  å¯èµilluma 奶ç²3段900g",35		"pdPrice": 238.00,36		"pdSold": 10237	}, {38		"pdImg": "../res/img/pd10.jpg",39		"pdName": "ã10ã  é
å¹Abbottä¹³èç½é¨å水解婴å¿é
æ¹å¥¶ç²3段820g",40		"pdPrice": 91.00,41		"pdSold": 13542	}, {43		"pdImg": "../res/img/pd11.jpg",44		"pdName": "ã11ã  é©è é
·ç«åèï¼ç¤¼çå¥è£
ï¼2.8g*4",45		"pdPrice": 151.00,46		"pdSold": 12347	}, {48		"pdImg": "../res/img/pd12.jpg",49		"pdName": "ã12ã  ä¿ç¨åºç´åã3å
è£
ãæ¥æ¬Merriesè±ç纸尿裤NB90",50		"pdPrice": 292.00,51		"pdSold": 193352	}, {53		"pdImg": "../res/img/pd13.jpg",54		"pdName": "ã13ã  Comotomoå¯ä¹å¤ä¹ ç¡
è¶å¥¶ç¶ï¼0-3æå¥¶å´ï¼150ml绿è²",55		"pdPrice": 245.00,56		"pdSold": 9557	}, {58		"pdImg": "../res/img/pd14.jpg",59		"pdName": "ã14ã  é¦æ¸¯ç´é®å¾·å½çå¾·é²Rival de Loopè¦èç²¾åå®ç¶",60		"pdPrice": 163.00,61		"pdSold": 7562	}, {63		"pdImg": "../res/img/pd15.jpg",64		"pdName": "ã15ã  ä¿ç¨åºç´åè¯å¸å å°é©¬æ²¹é¦è峿¸©åä¿æ¹¿æ åºæ¿é¢é",65		"pdPrice": 259.00,66		"pdSold": 8667	}, {68		"pdImg": "../res/img/pd16.jpg",69		"pdName": "ã16ã  é¦æ¸¯ç´é®æ¥æ¬Spatreatmentç¼èä¿æ¹¿å»ç»çº¹æ³ä»¤çº¹",70		"pdPrice": 237.00,71		"pdSold": 5872	}, {73		"pdImg": "../res/img/pd17.jpg",74		"pdName": "ã17ã  é©å½MEDIHEALNMFå¯è±ä¸éåç¡ç é¢è",75		"pdPrice": 81.00,76		"pdSold": 13577	}, {78		"pdImg": "../res/img/pd18.jpg",79		"pdName": "ã18ã  DHCè¶ç¿ è¯æ©æ¦èèæ»å
»æ´è¸æå·¥ç90g",80		"pdPrice": 123.00,81		"pdSold": 8782	}, {83		"pdImg": "../res/img/pd19.jpg",84		"pdName": "ã19ã  æ¥æ¬èµçå CPBèè¤ä¹é¥æ°çéç¦»é æ¸
ç½å 30ml",85		"pdPrice": 429.00,86		"pdSold": 4587	}, {88		"pdImg": "../res/img/pd20.jpg",89		"pdName": "ã20ã Heinzäº¨æ° å©´å¿é¢æ¡ä¼å é¢æ¡å
¨ç´ å¥é¤ç»å3å£å³3ç",90		"pdPrice": 39.00,91		"pdSold": 3292	}, {93		"pdImg": "../res/img/pd21.jpg",94		"pdName": "ã21ã  Heinzäº¨æ° ä¹ç»´æ»ææ±æ³¥ç»å5å£å³15è¢",95		"pdPrice": 64.00,96		"pdSold": 7597	}, {98		"pdImg": "../res/img/pd22.jpg",99		"pdName": "ã22ã  ä¿ç¨åºç´å澳大å©äºSwisse髿µåº¦èè¶èè¶å30ç²",100		"pdPrice": 271.00,101		"pdSold": 12102	}, {103		"pdImg": "../res/img/pd23.jpg",104		"pdName": "ã23ã  æªå¨Nordic Naturalså°é±¼å©´å¹¼å¿é±¼æ²¹DHAæ»´å",105		"pdPrice": 175.00,106		"pdSold": 111107	}, {108		"pdImg": "../res/img/pd24.jpg",109		"pdName": "ã24ã  æ¾³å¤§å©äºBio island DHA for Pregnancyæµ·è»æ²¹DHA",110		"pdPrice": 289.00,111		"pdSold": 28112	}, {113		"pdImg": "../res/img/pd25.jpg",114		"pdName": "ã25ã  æ¾³å¤§å©äºFatblaster Coconut Detoxæ¤°åæ°´",115		"pdPrice": 152.00,116		"pdSold": 17117	}, {118		"pdImg": "../res/img/pd26.jpg",119		"pdName": "ã26ã  Suitskyèæ¯å¥ é«æ¤æèèç½çº¸å°¿çå°¿ä¸æ¹¿XL60",120		"pdPrice": 99.00,121		"pdSold": 181122	}, {123		"pdImg": "../res/img/pd27.jpg",124		"pdName": "ã27ã  è±å½JUST SOAPæå·¥ç ç«ç°å¤©ç«ºèµèç³ç",125		"pdPrice": 72.00,126		"pdSold": 66127	}, {128		"pdImg": "../res/img/pd28.jpg",129		"pdName": "ã28ã  å¾·å½NUK å¤è²å©´å¹¼å¿å¸¦çå¦é¥®æ¯",130		"pdPrice": 92.00,131		"pdSold": 138132	}...Using AI Code Generation
1var pd = require('protractor-demo-helper');2var EC = protractor.ExpectedConditions;3var helper = new pd.ProtractorDemoHelper();4var helper2 = new pd.ProtractorDemoHelper();5var helper3 = new pd.ProtractorDemoHelper();6var helper4 = new pd.ProtractorDemoHelper();7var helper5 = new pd.ProtractorDemoHelper();8describe('Protractor Demo App', function() {9  it('should have a title', function() {10    browser.getTitle().then(function(title) {11      helper.addStep('Get title of the page', 'Title should be ' + title, 'Title is ' + title);12    });13  });14  it('should add one and two', function() {15    element(by.model('first')).sendKeys(1);16    element(by.model('second')).sendKeys(2);17    element(by.id('gobutton')).click();18    browser.wait(EC.visibilityOf(element(by.binding('latest'))), 5000);19    element(by.binding('latest')).getText().then(function(text) {20      helper2.addStep('Get the result of the addition', 'Result should be 3', 'Result is ' + text);21    });22  });23  it('should add four and five', function() {24    element(by.model('first')).sendKeys(4);25    element(by.model('second')).sendKeys(5);26    element(by.id('gobutton')).click();27    browser.wait(EC.visibilityOf(element(by.binding('latest'))), 5000);28    element(by.binding('latest')).getText().then(function(text) {29      helper3.addStep('Get the result of the addition', 'Result should be 9', 'Result is ' + text);30    });31  });32  it('should add seven and eight', function() {33    element(by.model('first')).sendKeys(7);34    element(by.model('second')).sendKeys(8);35    element(by.id('gobutton')).click();36    browser.wait(EC.visibilityOf(element(by.binding('latest'))), 5000);37    element(by.binding('latest')).getText().then(function(text) {38      helper4.addStep('Get the result of the addition', 'Result should be 15', 'Result is ' + text);39    });Using AI Code Generation
1var pd = require('protractor-debugger');2pd.debug(browser, 'localhost', 5858);3var pd = require('protractor-debugger');4pd.debug(browser, 'localhost', 5858);5var pd = require('protractor-debugger');6pd.debug(browser, 'localhost', 5858);7var pd = require('protractor-debugger');8pd.debug(browser, 'localhost', 5858);9var pd = require('protractor-debugger');10pd.debug(browser, 'localhost', 5858);11var pd = require('protractor-debugger');12pd.debug(browser, 'localhost', 5858);13var pd = require('protractor-debugger');14pd.debug(browser, 'localhost', 5858);15var pd = require('protractor-debugger');16pd.debug(browser, 'localhost', 5858);17var pd = require('protractor-debugger');18pd.debug(browser, 'localhost', 5858);19var pd = require('protractor-debugger');20pd.debug(browser, 'localhost', 5858);21var pd = require('protractor-debugger');22pd.debug(browser, 'localhost', 5858);23var pd = require('protractor-debugger');24pd.debug(browser, 'localhost', 5858);25var pd = require('protractor-debugger');26pd.debug(browser, 'localhost', 5858);27var pd = require('protractor-debugger');28pd.debug(browser, 'localhost', 5858);29var pd = require('protractor-debugger');30pd.debug(browser, 'localhost', 5858);31var pd = require('protractor-debugger');32pd.debug(browser, 'localhost', 5858);33var pd = require('protractor-debugger');34pd.debug(browser, 'localhost', 5858);35var pd = require('proUsing AI Code Generation
1var pd = require('protractor-demo');2var ptor = protractor.getInstance();3pd.get(ptor).then(function(url) {4  console.log(url);5});6pd.getTitle(ptor).then(function(title) {7  console.log(title);8});9pd.getWindowHandle(ptor).then(function(handle) {10  console.log(handle);11});12pd.getWindowHandles(ptor).then(function(handles) {13  console.log(handles);14});15pd.getWindowSize(ptor).then(function(size) {16  console.log(size);17});18pd.getWindowPosition(ptor).then(function(position) {19  console.log(position);20});21pd.getPageSource(ptor).then(function(source) {22  console.log(source);23});24pd.getCurrentUrl(ptor).then(function(currentUrl) {25  console.log(currentUrl);26});27pd.getOrientation(ptor).then(function(orientation) {28  console.log(orientation);29});30pd.getSessionId(ptor).then(function(sessionId) {31  console.log(sessionId);32});33pd.getCapabilities(ptor).then(function(capabilities) {34  console.log(capabilities);35});36pd.getAlert(ptor).then(function(alert) {37  console.log(alert);38});39pd.getLogs(ptor).then(function(logs) {40  console.log(logs);41});42pd.getNetworkConnection(ptor).then(function(networkConnection) {43  console.log(networkConnection);44});45pd.getPerformance(ptor).then(function(performance) {46  console.log(performance);47});48pd.getAvailableLogTypes(ptor).then(function(availableLogTypes) {49  console.log(availableLogTypes);50});51pd.getAvailableContexts(ptor).then(function(availableContexts) {52  console.log(availableContexts);53});54pd.getCurrentContext(ptor).then(function(currentContext) {55  console.log(currentContext);56});57pd.getDeviceTime(ptor).then(function(deviceTime) {Using AI Code Generation
1var ProtractorUtils = require('protractor-utils');2var pd = new ProtractorUtils.ProtractorDriver();3pd.searchFor('Protractor');4pd.clickOnLink('Protractor - end-to-end testing for AngularJS');5var ProtractorUtils = require('protractor-utils');6var pd = new ProtractorUtils.ProtractorDriver();7pd.searchFor('Protractor');8pd.clickOnLink('Protractor - end-to-end testing for AngularJS');9var ProtractorUtils = require('protractor-utils');10var pd = new ProtractorUtils.ProtractorDriver();11pd.searchFor('Protractor');12pd.clickOnLink('Protractor - end-to-end testing for AngularJS');13var ProtractorUtils = require('protractor-utils');14var pd = new ProtractorUtils.ProtractorDriver();15pd.searchFor('Protractor');16pd.clickOnLink('Protractor - end-to-end testing for AngularJS');17var ProtractorUtils = require('protractor-utils');18var pd = new ProtractorUtils.ProtractorDriver();19pd.searchFor('Protractor');20pd.clickOnLink('Protractor - end-to-end testing for AngularJS');21var ProtractorUtils = require('protractor-utils');22var pd = new ProtractorUtils.ProtractorDriver();23pd.searchFor('Protractor');24pd.clickOnLink('Protractor - end-to-end testing for AngularJS');25var ProtractorUtils = require('protractor-utils');26var pd = new ProtractorUtils.ProtractorDriver();27pd.searchFor('Protractor');28pd.clickOnLink('Protractor - end-to-end testing for AngularJS');29var ProtractorUtils = require('protractor-utils');30var pd = new ProtractorUtils.ProtractorDriver();31pd.searchFor('Using AI Code Generation
1var pd = require('protractor-cucumber-pagedef');2var homePage = new pd.PageDef('homePage');3homePage.addSection({4    locator: by.id('login')5});6homePage.addSection({7    locator: by.id('register')8});9homePage.addSection({10    locator: by.id('forgotPassword')11});12homePage.addSection({13    locator: by.id('loginForm')14});15homePage.addSection({16    locator: by.id('registerForm')17});18homePage.addSection({19    locator: by.id('forgotPasswordForm')20});21homePage.addSection({22    locator: by.id('loginButton')23});24homePage.addSection({25    locator: by.id('registerButton')26});27homePage.addSection({28    locator: by.id('forgotPasswordButton')29});30homePage.addSection({31    locator: by.id('loginEmail')32});33homePage.addSection({34    locator: by.id('loginPassword')35});36homePage.addSection({37    locator: by.id('registerEmail')38});39homePage.addSection({40    locator: by.id('registerPassword')41});42homePage.addSection({43    locator: by.id('registerConfirmPassword')44});45homePage.addSection({46    locator: by.id('forgotPasswordEmail')47});48module.exports = homePage;49var pd = require('protractor-cucumber-pagedef');50var homePage = new pd.PageDef('homePage');51module.exports = function() {52    this.Given(/^I am on the homepage$/, function(callback) {53        callback();54    });55    this.When(/^I click on the login button$/, function(callback) {56        homePage.getSection('login').click();57        callback();58    });59    this.Then(/^I should see the login form$/, function(callback) {60        homePage.getSection('loginForm').isDisplayedProtractor is developed by Google Developers to test Angular and AngularJS code. Today, it is used to test non-Angular applications as well. It performs a real-world user-like test against your application in a real browser. It comes under an end-to-end testing framework. As of now, Selenium Protractor has proved to be a popular framework for end-to-end automation for AngularJS.
Let’s talk about what it does:
 Protractor is a JavaScript framework, end-to-end test automation framework for Angular and AngularJS applications.
Protractor Selenium provides new locator methods that actually make it easier to find elements in the DOM.
Two files are required to execute Protractor Selenium tests for end-to-end automation: Specs & Config. Go through the link above to understand in a better way.
To carry out extensive, automated cross browser testing, you can't imagine installing thousands of the available browsers on your own workstation. The only way to increase browser usage is through remote execution on the cloud. To execute your automation test scripts across a variety of platforms and browser versions, LambdaTest offers more than 3000 browsers.
We recommend Selenium for end-to-end automation for AngularJS because both are maintained and owned by Google, and they build JavaScript test automation framework to handle AngularJS components in a way that better matches how developers use it.
For scripting, selenium locators are essential since if they're off, your automation scripts won't run. Therefore, in any testing framework, these Selenium locators are the foundation of your Selenium test automation efforts.
To make sure that your Selenium automation tests function as intended, debugging can be an effective option. Check the blog to know more.
If you are not familiar with writing Selenium test automation on Protractor, here is a blog for you to get you understand in depth.
Selenium tests are asynchronous and there are various reasons for a timeout to occur in a Protractor test. Find out how to handle timeouts in this Protractor tutorial.
In this Protractor tutorial, learn how to handle frames or iframes in Selenium with Protractor for automated browser testing.
Handle alerts and popups in Protractor more efficiently. It can be confusing. Here's a simple guide to understand how to handle alerts and popups in Selenium.
Get 100 minutes of automation test minutes FREE!!
