I'd like to retrieve the number after the attribute "ean13" inside the category:
<script>
universal_variable['product'] = {
id: 29363,
ean13: '4005900288646',
name: 'Cellular Perfect Skin Cuidado De Día Fp 15',
brand: 'Nivea',
price: 13.97,
old_price: 19.95,
active: 1,
categories: 'Cremas Hidratantes y Antiedad, Cuidado Facial, Higiene y Belleza',
url: 'https://www.ulabox.com/producto/cellular-perfect-skin-cuidado-de-dia-fp-15/29363',
image: 'https://static.ulabox.com/media/62855_l1.jpg'
};
</script>
Try this one to get 4005900288646
//script/substring-before(substring-after(., "ean13: '"), "',")
Related
I've two locale; "fa" and "en" with fa being default. I've tried to change it with the following code block both on nuxtServerInit and fetch hook of layout but it still revert back to my default locale and gives me json.parse error on route change.
// using "nuxt": "^2.15.8" , "#nuxtjs/i18n": "^7.2.0" , "#nuxtjs/universal-storage": "^0.5.9" , "#nuxtjs/vuetify": "^1.12.3"
async fetch(){
let locale = this.$storage.getCookie('localeLang')
if(!!locale){
await this.$i18n.setLocale(locale)
this.$vuetify.rtl = this.$i18n.localeProperties.dir === 'rtl'
this.$storage.setCookie('localeLang', locale, {maxAge: 315360000})
}
}
When using in fetch hook i can see for a moment that it's in en then revert back to fa . but the htmlAttr of meta are set according to en locale (which has been set on cookie)
So what should I do? Any idea?
// nuxt.config.js
i18n: {
baseURL: process.env.DEFAULT_BASE_URL,
locales:[
{
code: 'fa',
iso: 'fa-IR',
file: 'fa.js',
currency: {name:'تومان', sign:'ت'},
dir: 'rtl',
name: 'فارسی',
initial: 'FA',
},
{
code: 'en',
iso: 'en-US',
file: 'en.js',
currency: {name:'Dollar', sign:'$'},
dir: 'ltr',
name: 'English',
initial: 'EN',
},
],
defaultLocale: 'fa',
strategy: 'no_prefix',
lazy: true,
langDir: '~/locale/lang/',
detectBrowserLanguage: false,
// vueI18n: '~/plugins/vue-i18n.js',
},
Hi I want to create AWS::Pinpoint::PushTemplate using cloudformation template and I am following this link: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-pinpoint-pushtemplate.html.
Type: AWS::Pinpoint::PushTemplate
Properties:
Default:
Action: OPEN_APP
Body: FirstName - {{firstName}}, LastName - {{lastName}}
Title: Title
DefaultSubstitutions:
firstName: default
lastName: default
Tags:
project: project
tashi: "Pinpoint Template"
TemplateName: template_name
I am getting type validation error for`DefaultSubstitutions: Property validation failure: [Value of property {/DefaultSubstitutions} does not match type {String}]
According to docs DefaultSubstitutions is a String.
However, in your case, you set it up as map:
DefaultSubstitutions:
firstName: default
lastName: default
Maybe have to try using it as json string:
DefaultSubstitutions: "{\"firstName"\:\"default\", \"lastName"\:\"default\"}"
I would like to transfer javascript generated view to an xmlView.
This works great and I can add it to the shell:
var headItem = new sap.ui.unified.ShellHeadItem({
icon: "sap-icon://upload-to-cloud",
id: "network-icon",
customData: [
new sap.ui.core.CustomData({
key: "color",
value: "{= ${appValues>/isOnline} ? 'is-online' : 'is-offline' }",
writeToDom: true
})
]
});
What do I need to do to add this to an XML View:
<u:ShellHeadItem
id="network-icon"
icon="sap-icon://upload-to-cloud"
tooltip="Network status"/>
I tried to add it in the viewController, but it does not update the DOM.
onInit: function() {
var oNetworkIcon = this.getView().byId("network-icon");
oNetworkIcon.setModel(sap.ui.getCore().getModel("appValues"));
oNetworkIcon.addCustomData(new sap.ui.core.CustomData({
key: "color",
value: "{= ${/isOnline} ? 'is-online' : 'is-offline' }",
writeToDom: true
}));
//if you happen to know how to add a class
oNetworkIcon.addStyleClass("blub");
},
Try this:
<u:ShellHeadItem
id="network-icon"
icon="sap-icon://upload-to-cloud"
tooltip="Network status">
<u:customData>
<core:CustomData key="color" value="{= ${/isOnline} ? 'is-online' : 'is-offline' }" writeToDom="true" />
</u:customData>
</u:ShellHeadItem>
I am aware that the OP is asking for a way to write the data into the DOM.
But for those who need to access the extra data of a control through JS only:
This method is more streamlined and easier to read:
<mvc:View xmlns:mvc="sap.ui.core.mvc"
xmlns:customData="http://schemas.sap.com/sapui5/extension/sap.ui.core.CustomData/1"
xmlns:unified="sap.ui.unified">
<unified:ShellHeadItem id="network-icon"
icon="sap-icon://upload-to-cloud"
tooltip="Network status"
customData:color="{= ${/isOnline} ? 'is-online' : 'is-offline' }" />
</mvc:View>
You can access this extra data like so:
var myData = this.byId("network-icon").data("color");
Documentation: Custom Data - Attaching Data Objects to Controls (See "Use in XML Views").
I wanted to know if we can remove options like "dev tools","monitering" etc from kibana page , localhost:5601. I want to have only Dashboard visualization options .
Nevermind, I found one way to do this by modifying src/core_plugins/kibana/index.js , deleting these blocks
{
id: 'kibana:dev_tools',
title: 'Dev Tools',
order: 9001,
url: '/app/kibana#/dev_tools',
description: 'development tools',
icon: 'plugins/kibana/assets/wrench.svg'
}, {
id: 'kibana:management',
title: 'Management',
order: 9003,
url: `${kbnBaseUrl}#/management`,
description: 'define index patterns, change config, and more',
icon: 'plugins/kibana/assets/settings.svg',
linkToLastSubUrl: false
}
and other blocks as per your need
I am changing only a couple of pages but docpad seems to render everything again. I'm not using any fancy plugins or dynamic components - just the basic ghost template. Are there some techniques to make less pages render?
maybe its something to do with the timestamp format in the docpad.coffee ?
moment = require('moment')
docpadConfig = {
templateData:
vars:
appserver: 'http://xxx'
site:
title: 'Pocket Tutor'
tagline: 'English language chat tutor'
description: 'Learn english by chatting'
logo: '/uploads/images/corpid/comiceng/96/logo-96.png'
url: 'http://app:9005'
cover: '/img/cover.jpg'
navigation: [
{
name: 'Home',
href: '/',
section: 'home'
},
{
name: 'About',
href: '/about.html',
section: 'about'
},
{
name: 'Lessons',
href: '/tags/lessons.html',
section: 'tag-lessons'
},
{
name: 'Grammar',
href: '/tags/grammar.html',
section: 'tag-grammar'
}
{
name: 'Teachers',
href: '/tags/tech.html',
section: 'tag-tech'
},
]
author:
name: 'Rikai Labs'
img: ''
url: 'http://rikai.co'
website: 'http://RIKAI.co'
location: 'space',
bio: 'we build chat apps'
getPreparedTitle: -> if #document.title then "#{#document.title} | #{#site.title}" else #site.title
getDescription: -> if #document.description then "#{#document.description} | #{#site.description}" else #site.description
bodyClass: -> if #document.isPost then "post-template" else "home-template"
masthead: (d) ->
d = d || #document
if d.cover then d.cover else #site.cover
isCurrent: (l) ->
if #document.section is l.section then ' nav-current'
else if #document.url is l.href then ' nav-current'
else ''
excerpt: (p,w) ->
w = w || 26
if p.excerpt then p.excerpt else p.content.replace(/<%.+%>/gi, '').split(' ').slice(0, w).join(' ')
encode: (s) -> encodeURIComponent(s)
slug: (s) -> return s.toLowerCase().replace(' ', '-')
currentYear: -> new Date().getFullYear()
time: (ts, format) ->
format = format || 'MMMM DO, YYYY'
ts = new Date(ts) || new Date()
moment(ts).format(format)
collections:
posts: ->
#getCollection("html").findAllLive({active:true, isPost: true, isPagedAuto: {$ne: true}}, {postDate: -1}).on "add", (model) ->
model.setMetaDefaults({layout:"post"})
plugins:
tags:
extension: '.html'
injectDocumentHelper: (doc) ->
doc.setMeta { layout: 'tag' }
rss:
default:
collection: 'posts'
url: '/rss.xml'
marked:
gfm: true
environments: # default
development: # default
# Always refresh from server
maxAge: false # default
# Only do these if we are running standalone via the `docpad` executable
checkVersion: process.argv.length >= 2 and /docpad$/.test(process.argv[1]) # default
welcome: process.argv.length >= 2 and /docpad$/.test(process.argv[1]) # default
prompts: process.argv.length >= 2 and /docpad$/.test(process.argv[1]) # default
# Listen to port 9005 on the development environment
port: 9005 # example
production:
port: 9005
maxAge: false # default
}
module.exports = docpadConfig
update: stubbing out the date and time methods
time: -> 'time'
currentYear: -> 'year'
gives a little speed up but still making one edit to one file gives info:
Generated 40/150 files in 7.364 seconds
update2: added
standalone: true
to some pages to test, but still takes
info: Generated 40/150 files in 7.252 seconds
so even a single standalone page triggers a bunch of other stuff.
It is possible to handle the Docpad regeneration process manually. To do this you need to turn off Docpad's watch. That is, run Docpad with the docpad server command. What will happen here is that it doesn't matter how many times you edit a document it will not be loaded into the docpad collection. You will then have to load any updates manually. That is, have some code to load the document.
model = #docpad.getCollection('posts').findOne({someValue: someValue})
model.load()
Following that trigger the regeneration.
#docpad.action 'generate', reset: false, (err) ->
if err
#docpad.log "warn", "GENERATE ERROR"
This is what I do in my posteditor plugin
I suspect this is not really what you are asking for but it does give you full control over the regeneration process.