Emaze Plugin Help
-
"use strict"; var Prezi = {}, Embed = '<iframe src="http://prezi.com/embed/$1/?bgcolor=ffffff&lock_to_path=0&autoplay=0&autohide_ctrls=0#" allowfullscreen="" mozallowfullscreen="" webkitallowfullscreen="" frameborder="0" height="400" width="550"></iframe>'; var Prezi = /<a href="(?:https?:\/\/)?\/prezi.com\/([\w\-_]+)\/.+">.+<\/a>/g; Prezi.parse = function(data, callback) { if (!data || !data.postData || !data.postData.content) { return callback(null, data); } if (data.postData.content.match(Prezi)) { data.postData.content = data.postData.content.replace(Prezi, Embed); } callback(null, data); }; module.exports = Prezi; }(module));
Should do it.
-
Okay, thanks for your help so far. When I try the Emaze plugin, I receive this error: ^
18/2 15:33 [7624] - error: SyntaxError: Unexpected token }
at Module._compile (module.js:439:25)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:364:17)
at require (module.js:380:17) -
@JonDoe12 Got a link to the page you're testing?
Not sure why my paste didn't work, but yes, the full code should be(function(module) { "use strict"; var Prezi = {}, Embed = '<iframe src="http://prezi.com/embed/$1/?bgcolor=ffffff&lock_to_path=0&autoplay=0&autohide_ctrls=0#" allowfullscreen="" mozallowfullscreen="" webkitallowfullscreen="" frameborder="0" height="400" width="550"></iframe>'; var Prezi = /<a href="(?:https?:\/\/)?\/prezi.com\/([\w\-_]+)\/.+">.+<\/a>/g; Prezi.parse = function(data, callback) { if (!data || !data.postData || !data.postData.content) { return callback(null, data); } if (data.postData.content.match(Prezi)) { data.postData.content = data.postData.content.replace(Prezi, Embed); } callback(null, data); }; module.exports = Prezi; }(module));
Just replace the bit between }(module)); and the start for the emaze plugin.
-
The site is in development on my local host, I wish I could link it here. This is my full code for the emaze plugin, but the link just remains a link without becoming an iframe. Update: The prezi plugin doesn't seem to be working either.
Emaze Plugin:
(function(module) { "use strict"; var Emaze = {}, Embed = '<iframe src="http://app.emaze.com/@$1/$2" width="960px" height="540px" seamless webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>'; var Emaze = /<a href="(?:https?:\/\/)?\/app.emaze.com\/@([\w\-_]+)\/([\w\-_]+)">.+<\/a>/g; Emaze.parse = function(data, callback) { if (!data || !data.postData || !data.postData.content) { return callback(null, data); } if (data.postData.content.match(Emaze)) { data.postData.content = data.postData.content.replace(Emaze, Embed); } callback(null, data); }; module.exports = Emaze; }(module));
-
Thank you. In the mean time, I'll keep cranking away and try to find the issue. I appreciate your help.
My current theory is that:
"(?:https?:\/\/)?\/app.emaze.com"
-may have one too many "/". We're escaping in between the "?" and app.emaze.com. However, I think that would make the URL have three "/" as in:
https?:///app.emaze.com
Update on Emaze: Yes, that was it. There were one too many "/". This is the regex that worked for me:
var Emaze = /<a href="(?:https?:\/\/)?app.emaze.com\/@([\w\-_]+)\/([\w\-_]+)">.+<\/a>/g;
I'm starting on prezi now.
-
I was just going to let you take most of the credit. It's still your plugin, and you helped me make the modifications. I'm working on a new modification now, though. I'm trying to get the presentations to embed into an area of the user's profile.
Right now, I'm testing it with the Fullname field on the profile, by entering the URL of the presentations (instead of a human name) and seeing if it parses into an embedded slide show.
Would this be easy to accomplish? If not, are there any hints you could give me @a_5mith ?
So far, I've edited the library.js file and replaced data.post and data.post.conent with data.fullname and data.fullname.content. I've also tried changing the hook in plugin.js from:
{ "hook": "filter:parse.post", "method": "parse", "callbacked": true } ]
to
{ "hook": "action:user.set", "method": "parse", "callbacked": true } ]
I feel like I'm missing something, though. If you're up to it, I'd like to collaborate with you further.