How to write html custom attribute in less use Mixins [closed] - less

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
how to write html custom attribute in .less Use Mixins for example
[margin="2"]{margin:2px;}

You should explain why you want to use Less in this situation. Notice that Less only compiles static CSS.
You can use a Less mixin to dynamically built your CSS rules:
.createmargins(#i) {
& when (#i > 1) {
.createmargins(#i - 1);
}
[margin="#{i}"] { margin: unit(#i,px); }
}
.createmargins(100);
outputs:
[margin="1"] {
margin: 1;
}
[margin="2"] {
margin: 2;
}
[margin="3"] {
margin: 3;
}
and so on......
Demo: http://codepen.io/anon/pen/yyXEgg
The above possible generates a lot of unused CSS classes. Alternatively consider using jQuery (or jvascript) on DOM ready:
$("[margin]").each(function(){
$(this).css('margin',$(this).attr('margin') + 'px');
});
Demo: http://codepen.io/anon/pen/rawKjz

Related

why can i not call a function of my vue component in my callback [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 1 year ago.
Improve this question
i am use datatables and jquery in vue and
> <script>
> export default {
> methods: {
> ddd() {
> alert(44444444);
> },
> },
> mounted: function () {
> let table = new DataTable("#tbl", {});
> $("#tbl tbody").on("click", "tr", function () {
> this.ddd();
> });
> },
> };
> </script>
why ddd() is not work please help me
Your issue is lexical scoping. the callback method you're provided is an anonymous function which redeclares the value of this. To solve it, use a fat arrow.
$("#tbl tbody").on("click", "tr", () => {
this.ddd();
});

Get DevExtreme DropDownBox Selected Values [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 3 years ago.
Improve this question
I use multi select DevExtreme DropdownBox in View and fill it from model
but I can't get selected values in controller on Post method
how I can read selected values?
I got a #Html.HiddenField then filled the hiddenfield value in below js function:
function getSelectedItemsKeys(items) {
var result = [];
items.forEach(function (item) {
if (item.selected) {
result.push(item.key);
}
if (item.items.length) {
result = result.concat(getSelectedItemsKeys(item.items));
}
});
$("#myHF").val(result);
return result;
}
then send hidden field to controller by view model.

more elegant way to set state [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 4 years ago.
Improve this question
In the following function is there a more elegant or best practice way to setState?
startStop(){
if(this.state.start === 'Start') startStop = 'Stop'
else startStop = 'Start'
this.setState({start:startStop})
}
for the flag, instead of string Start/Stop use true-false,
Eg:-
constructor(props){
this.state={
start:false
}
}
startStop(){
this.setState({start:!this.state.start})
}
render(){
return<Text>{this.state.start?'Running':'Stopped'}</Text>
}
If you had something like:
state = {
keepGoing: false,
}
Then you could do the following to toggle:
this.setState({ keepGoing: !this.state.keepGoing });
this.setState({start:this.state.start==='Start' ? 'Stop' : 'Start'})

What Charting API / Tool is this? [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 11 years ago.
Improve this question
What Charting API / Tool is this?
http://wordpress.org/extend/plugins/multiple-post-thumbnails/stats/
The pie chart at least is an svg canvas inside of an iframe. i am confused what they are using, but I like it.
image http://img38.imageshack.us/img38/6513/picturets.png
google.load("visualization", "1", {packages: ["corechart"]});
google.setOnLoadCallback(drawChart);
function drawChart() {
jQuery.getJSON('http://api.wordpress.org/stats/plugin/1.0/multiple-post-thumbnails?callback=?', function (data) {
draw_graph(data, 'version_stats', 'Active Versions');
});
}
function draw_graph(versions, id, title) {
var data = new google.visualization.DataTable();
data.addColumn('string', 'Version');
data.addColumn('number', 'Usage');
var count = 0;
jQuery.each(versions, function (key, value) {
if (Number(value) > 1) {
data.addRow();
data.setValue(count, 0, key);
data.setValue(count, 1, Number(value));
count++;
}
});
var chart = new google.visualization.PieChart(document.getElementById(id));
chart.draw(data, {width: 360, height: 240, title: title});
}
It looks like they are using Google's charting API: http://code.google.com/apis/chart/interactive/docs/index.html

Enable HTML Tags in PHPBB [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about programming within the scope defined in the help center.
Closed 8 years ago.
Improve this question
Im trying to find a way to enable HTML Tags in PHPBB (only for administrations).
do you know how can I achieve this?
Thanks
This is not supported out of the box. You should use custom BBCodes instead. If you really, really insist on HTML tags, you can use the Enable HTML MOD.
Lately I was busy porting Snitz 2.x based forum to phpbb3 forum.
The main challenge I had to deal with was around HTML support in the post body.
Snitz allowed HTML inside the post body but phpbb3 forbids HTML tags inside the post.
Since we have ~40000 posts that many of them contains HTML tags we had to find a solution for this.
Here it is: we used Enable HTML MOD but we modify it.
The original function:
function enable_html($text, $uid)
{
if (strpos($text, '[html') === false)
{
return $text;
}
$text = str_replace(array('[html:' . $uid . ']', '[/html:' . $uid . ']'), array('[html]', '[/html]'), $text);
$text_ary = explode('[html]', $text);
$text = '';
foreach ($text_ary as $tmp)
{
if (strpos($tmp, '[/html]'))
{
$tmp = explode('[/html]', $tmp, 2);
$text .= htmlspecialchars_decode(str_replace(array("\r\n", "\n"), ' ', $tmp[0])) . $tmp[1];
}
else
{
$text .= $tmp;
}
}
return str_replace(array('[html]', '[/html]'), '', $text);
}
was modified to
function enable_html($text, $uid)
{
return htmlspecialchars_decode($text);
}
The last step was to give the new permission to the users and we got the HTML rendered as we had it in Snitz.