Commit ba8f7d4b authored by Dave Lane's avatar Dave Lane
Browse files

initial working iframe implementation

parent 19371164
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -88,3 +88,7 @@ of course-sized open educational resources stored in WikiEducator.
I expect that different institutions (and even different courses
within an institution) will have different needs, organizations, and
styling.

Update 2019-07-23: added iFrame embedding capability using the new [WEiFrame template](https://wikieducator.org/Template:WEiFrame) on WikiEducator.

The main concern with this is that if the site you're wanting to include in the iframe has "X-Frame-Options" (in the sites website configuration, e.g. Apache or NGINX) is set to "sameorigin". That will block the iframe display. 
+4 −2
Original line number Diff line number Diff line
@@ -2,7 +2,7 @@
/* jshint node: true, multistr: true, trailing: true, esnext: true */
"use strict";

const VERSION = "1.0.0",
const VERSION = "1.1.0",
  JQUERY = "http://code.jquery.com/jquery-2.1.1.min.js",
  FILEPATH = "/home/www/www";

@@ -792,6 +792,7 @@ function getOutline() {
    });

    if (opt["--wpurl"]) {
      console.log('--wpurl');
      // allow the user to make the first page have no WP title
      // by giving it a slug, but seting the text to an empty string
      if (options.hasOwnProperty("no_landing_page_title")) {
@@ -802,6 +803,7 @@ function getOutline() {
      }
    }
    if (opt["--wpdelete"]) {
      console.log('--wpdelete');
      var posts = [];
      function deletePages() {
        var post;
@@ -821,7 +823,7 @@ function getOutline() {
          setImmediate(processPages);
        }
      }

      console.log('before getPosts');
      wp.getPosts({ post_type: "page", number: 200 }, ["post_id"], function(
        err,
        data
+3 −2
Original line number Diff line number Diff line
console.log('in iframe.js!');

module.exports = {
    version: "0.0.1",
    version: "0.1.0",
    process: function($, opt) {
        console.log('in iframe.js module!');
        var ifcount = 0,
@@ -15,7 +15,7 @@ module.exports = {
            ifid;
        // find the nodes in the Dom...
        $(".WEiFrame").each(function() {
            //iframe = ifurl = ifheight = ifwidth = ifstyle = ifstyle_string = ifclasses = ifid = "";
            iframe = ifurl = ifheight = ifwidth = ifstyle = ifstyle_string = ifclasses = ifid = "";
            ifcount += 1;
            console.log('WEiFrame '+ifcount+' ...');
            $(this).find("div").each(function() {
@@ -50,6 +50,7 @@ module.exports = {
            if (ifstyle_string != "") {
                iframe += ' style="'+ifstyle_string+'"';
            }
            //iframe = '<div class="WEiFrame"><iframe frameborder="0" '+iframe+' /></div>';
            iframe = '<div class="WEiFrame"><iframe '+iframe+' /></div>';
            console.log(ifcount+'. '+iframe);
            $(this).replaceWith(iframe);