[PLUGIN] HTML | iFrame

Post your completed addons to share with the community

Post » Fri Nov 25, 2016 8:46 am

Great! :D
Thanks
Last edited by christ59 on Fri Nov 25, 2016 9:07 am, edited 1 time in total.
B
6
S
1
Posts: 52
Reputation: 508

Post » Fri Nov 25, 2016 9:06 am

Message: christ59 can only post plain text URLS until they have 500 rep. 1 URLS modified. Why?
korbaach wrote:@Nandynho thaks for the plugin!
..it's nice to have html,iframe, .js & .css,all together in just one plugin..
one question..

is it possible to load javascript file in runtime ?
(let's say..On load completed)

because if I Ajax to load html & I use Properties bar to load .js

Image

sometimes browser alert error...


********************************************************


@christ59

Image

https://app.box.com/s/gjntj0xld9dg4y57p5i9ozm3e2um2wlm selectCopy.capx


Great! :D
It works very well with Chrome ... but not with Firefox and IE 11. Do you know why?

Another question.
1 / I created on my stage a textBox called "textBox".
I would like to display the output in this textbox.
Is it possible ?

2 / What does "innerHTML" match in the "test.js" file?

Thank you again for your help.
B
6
S
1
Posts: 52
Reputation: 508

Post » Fri Nov 25, 2016 9:55 am

christ59 wrote:It works very well with Chrome ... but not with Firefox and IE 11. Do you know why?

because load javascript file before htlm with ajax..if you load htlm with action
Image
everything works well..

christ59 wrote: I created on my stage a textBox called "textBox".
I would like to display the output in this textbox.
Is it possible ?


yes it's possible..you can copy selected text from plugin to c2 Textbox..
or or even between two textbox in c2

select2CopyPlugin.capx

christ59 wrote: What does "innerHTML" match in the "test.js" file?


i just copy script from link you post

Code: Select all
var quotearea = document.getElementById('quote')
var output = document.getElementById('output')
quotearea.addEventListener('mouseup', function(){
    if (this.selectionStart != this.selectionEnd){ // check the user has selected some text inside field
        var selectedtext = this.value.substring(this.selectionStart, this.selectionEnd)
        output.innerHTML = selectedtext
    }
}, false)
B
67
S
24
G
7
Posts: 1,518
Reputation: 11,072

Post » Fri Nov 25, 2016 10:19 am

Great!
Everything works very well!
Thank you again for your help.
B
6
S
1
Posts: 52
Reputation: 508

Post » Fri Nov 25, 2016 3:44 pm

Message: christ59 can only post plain text URLS until they have 500 rep. 2 URLS modified. Why?
korbaach wrote:
christ59 wrote:It works very well with Chrome ... but not with Firefox and IE 11. Do you know why?

because load javascript file before htlm with ajax..if you load htlm with action
Image
everything works well..

christ59 wrote: I created on my stage a textBox called "textBox".
I would like to display the output in this textbox.
Is it possible ?


yes it's possible..you can copy selected text from plugin to c2 Textbox..
or or even between two textbox in c2

https://app.box.com/s/n6s0hm50400grk67mcvvv9mhb49zlwur select2CopyPlugin.capx

christ59 wrote: What does "innerHTML" match in the "test.js" file?


i just copy script from link you post

Code: Select all
var quotearea = document.getElementById('quote')
var output = document.getElementById('output')
quotearea.addEventListener('mouseup', function(){
    if (this.selectionStart != this.selectionEnd){ // check the user has selected some text inside field
        var selectedtext = this.value.substring(this.selectionStart, this.selectionEnd)
        output.innerHTML = selectedtext
    }
}, false)


One last question ;) (I hope)
I tried to do the same but with a text in an xml.
But it does not work and I do not know why.
Below is the .CAPX link
Thanks again.
https://drive.google.com/open?id=0B25XbB2SefxZRmxPemVVQ0xFekk
B
6
S
1
Posts: 52
Reputation: 508

Post » Fri Nov 25, 2016 8:34 pm

@korbaach It's always good to hear compliments!
is it possible to load javascript file in runtime?

Yes it is possible to load at runtime, but it takes a few seconds to be ready to use.

...because if I Ajax to load html & I use Properties bar to load .js
sometimes browser alert error...

What is the error message? Is it some browser protection? Is there an error in the Node-Webkit preview?

@korbaach thank you for answering christ59 questions! I would not have done better.
********************************************************



@christ59 sorry for the delay but I see that you received an excellent help.
You don't need to load two .js files. They are universal scripts that will work with all objects within Construct 2.

You need to modify the textarea ID. ID's are unique.
Code: Select all
var output = document.getElementById('output');
////////////////////
// Quote ID 1
var quote1 = document.getElementById('quote1');
quote1.addEventListener('mouseup', function() {
    if (this.selectionStart != this.selectionEnd) {
        var selectedtext = this.value.substring(this.selectionStart, this.selectionEnd);
        document.getElementById('output').value = selectedtext;
    };
}, false);
////////////////////
// Quote ID 2
var quote2 = document.getElementById('quote2');
quote2.addEventListener('mouseup', function() {
    if (this.selectionStart != this.selectionEnd) {
        var selectedtext = this.value.substring(this.selectionStart, this.selectionEnd);
        document.getElementById('output').value = selectedtext;
    };
}, false);


Download
Last edited by Nandynho on Sat Nov 26, 2016 12:16 am, edited 1 time in total.
Bitcoin Wallet: 1GCRqZExcP6svMdKGpCaRH4A8QAZtSjXxu
B
46
S
18
Posts: 196
Reputation: 3,652

Post » Fri Nov 25, 2016 11:07 pm

@Nandynho run this copyPasteError.capx in Firefox & IE
you will see:
Image

in chrome/chromium browsers there is no error..

ok..
this javascript code can can be placed in function

Code: Select all
function copyPaste(){
var output = document.getElementById('output');
var quote = document.getElementById('quote');
quote.addEventListener('mouseup', function() {
    if (this.selectionStart != this.selectionEnd) {
        var selectedtext = this.value.substring(this.selectionStart, this.selectionEnd);
        document.getElementById('output').value = selectedtext;
    };
}, false);};

and use Browser object to trigger..
Image

and this works Ok in all browsers,no error...but sometimes it's not so simple..

so.. I expected in plugin action:
Code: Select all
<script src="test.js"></script>

Image
similar to Import CSS file
B
67
S
24
G
7
Posts: 1,518
Reputation: 11,072

Post » Sat Nov 26, 2016 12:20 am

@korbaach in the Firefox preview I did not see any errors. Is your Firefox up to date?
But anyway, he does not want two "selects"?
New Version 1.162 (Nov 27, 2016)
  • [+] Include Javascript File
Download - Capx
Bitcoin Wallet: 1GCRqZExcP6svMdKGpCaRH4A8QAZtSjXxu
B
46
S
18
Posts: 196
Reputation: 3,652

Post » Tue Nov 29, 2016 8:21 am

Great ! It works perfectly.
Ultimate question :D
Is it possible to retrieve the data in a Construct variable rather than in a text field?
Thanks for your help
B
6
S
1
Posts: 52
Reputation: 508

Post » Tue Nov 29, 2016 11:53 pm

Return a variable to Construct 2 or the other way around?
Capx
Bitcoin Wallet: 1GCRqZExcP6svMdKGpCaRH4A8QAZtSjXxu
B
46
S
18
Posts: 196
Reputation: 3,652

PreviousNext

Return to Completed Addons

Who is online

Users browsing this forum: No registered users and 10 guests