Blogue

Test JSON

{
  "@context": "/platform/v3/contexts/products",
  "@id": "/platform/v3/products/4",
  "@type": "products",
  "timestamp": "2018-02-12T15:09:55-05:00",
  "sku": null,
  "version": null,
  "price": "0.00000",
  "priceSpecial": "0.00000",
  "visibleStatus": true,
  "taxable": true,
  "country": null,
  "place": null,
  "placePrecision": null,
  "producible": true,
  "newStatus": true,
  "type": {
  "@id": "/platform/v3/product_types/1",
  "@type": "product_types",
  "id": 1,
  "createdAt": "2000-01-01T00:00:00-05:00",
  "updatedAt": "2000-01-01T00:00:00-05:00"
},
  "brand": null,
  "supplier": {
  "@id": "/platform/v3/person_suppliers/1",
  "@type": "person_suppliers",
  "id": 1,
  "createdAt": "2000-01-01T00:00:00-05:00",
  "updatedAt": "2000-01-01T00:00:00-05:00",
  "toString": "Interne in"
},
  "weight": "0.00000",
  "dimensionW": "0.00",
  "dimensionH": "0.00",
  "dimensionD": "0.00",
  "time": "0.00",
  "cost": "0.00000",
  "additionnalProductionCost": "0.00000",
  "costSpecial": "0.00000",
  "invQtyMin": "0.000",
  "invQtyMax": "100.000",
  "moq": "0.000",
  "packageOrder": "0.000",
  "inventoryTracking": true,
  "rentTracking": false,
  "countedInInventory": true,
  "shippingTracking": false,
  "notes": "",
  "thumbnail": null,
  "imageSmall1": null,
  "imageSmall2": null,
  "image": null,
  "unitType": {
  "@id": "/platform/v3/product_unit_types/1",
  "@type": "product_unit_types",
  "id": 1,
  "createdAt": "2000-01-01T00:00:00-05:00",
  "updatedAt": "2000-01-01T00:00:00-05:00"
},
  "unitNb": "1.000",
  "supplierCode": null,
  "clientCode": null,
  "shCode": null,
  "reservationPeriodicity": {
  "@id": "/platform/v3/periods/3",
  "@type": "periods",
  "id": 3,
  "createdAt": "2000-01-01T00:00:00-05:00",
  "updatedAt": "2000-01-01T00:00:00-05:00"
},
  "periodicityPrecision": "0.000",
  "bookable": true,
  "discountable": true,
  "salable": true,
  "invoiceLineType": {
  "@id": "/platform/v3/invoice_line_types/3",
  "@type": "invoice_line_types",
  "id": 3,
  "createdAt": "2000-01-01T00:00:00-05:00",
  "updatedAt": "2000-01-01T00:00:00-05:00"
},
  "purchasable": true,
  "billLineType": {
  "@id": "/platform/v3/bill_line_types/8",
  "@type": "bill_line_types",
  "id": 8,
  "createdAt": "2000-01-01T00:00:00-05:00",
  "updatedAt": "2000-01-01T00:00:00-05:00"
},
  "onDistribution": true,
  "onWebsite": true,
  "owningCorporation": null,
  "isVariableExpense": true,
  "isImmo": false,
  "id": 4,
  "createdAt": "2018-02-12T15:09:55-05:00",
  "updatedAt": "2018-02-12T15:09:55-05:00",
  "toString": "Produit de base A4",
  "billLinesListing": "/platform/v3/bill_lines?product=4",
  "invoiceLinesListing": "/platform/v3/invoice_lines?product=4",
  "rentsListing": "/platform/v3/rents?product=4",
  "rentsChargedListing": "/platform/v3/rents?chargedProduct=4",
  "inventoryEntriesListing": "/platform/v3/inventory_entries?product=4",
  "applicableCost": "0.00000",
  "name": "Produit de base",
  "description": "<p>Produit de base</p>",
  "applicablePrice": "0.00000",
  "inStock": 50,
  "correction": 0,
  "productOptionsListing": "/platform/v3/product_product_options?product=4",
  "subProductOptionsListing": "/platform/v3/product_product_options?subProduct=4",
  "productComponentsListing": "/platform/v3/product_product_components?product=4",
  "componentProductsListing": "/platform/v3/product_product_components?component=4",
  "translationsListing": "/platform/v3/product_producttranslations?translatable=4",
  "buyableBasePrice": "0.00000",
  "discount": "0.00"
}
Element.implement({
    /**
     * Highlights an element/Removes Element highlighting
     *
     * @param {Object, Boolean} [options] EnlighterJS options Object or Boolean value to enable/disable highlighting
     * @returns {Element} The current Element instance.
     */
    enlight: function(options){
        // mixed input check - options available ?
        options = (typeof(options) == "undefined") ? {} : options;

        // convert "true" to empty Object!
        options = (options===true) ? {} : options;

        // enlighter instance already available ?
        var enlighter = this.retrieve('EnlighterInstance');

        // hide highlighted sourcecode ?
        if (options === false){
            if (enlighter !== null) {
                enlighter.enlight(false);
            }
        // highlight sourcecode and use options
        }else{
            // create new enlighter instance
            if (enlighter === null) {
                enlighter = new EJS(this, options, null);
                this.store('EnlighterInstance', enlighter);
            }
            enlighter.enlight(options);
        }

        // element instance
        return this;
    },
});