diff --git a/src/pat/inject/index.html b/src/pat/inject/index.html index e027765dc..974f18a4f 100644 --- a/src/pat/inject/index.html +++ b/src/pat/inject/index.html @@ -55,9 +55,24 @@ Trigger an inject that fails. (Puts an error message in a data attribute on the body tag) <a href="page-that-doesnt-exist" class="pat-inject"> +
  • + Place "Wilde in column 2 when + +
  • +
  • + Load text into column 1 and scoll to #scroll-target + <a href="inject-text.html" class="pat-inject" data-pat-inject="scroll: #scroll-target"> +
  • +
  • + Re-inject this entire page and scroll to the demo area + <a href="index.html" class="pat-inject" data-pat-inject="scroll: #poems"> +
  • +

    diff --git a/src/pat/inject/inject-sources.html b/src/pat/inject/inject-sources.html index 44ff04fd5..f30b292e2 100644 --- a/src/pat/inject/inject-sources.html +++ b/src/pat/inject/inject-sources.html @@ -3,7 +3,6 @@ Demo page - diff --git a/src/pat/inject/inject-text.html b/src/pat/inject/inject-text.html new file mode 100644 index 000000000..99255003b --- /dev/null +++ b/src/pat/inject/inject-text.html @@ -0,0 +1,45 @@ + + + + + Demo page + + +

    +

    Immer wieder

    +

    + Immer wieder, ob wir der Liebe Landschaft auch kennen
    und den kleinen Kirchhof mit seinen klagenden Namen
    + und die furchtbar verschweigende Schlucht, in welcher die anderen
    + enden: immer wieder gehn wir zu zweien hinaus
    unter die alten Bäume, lagern uns immer wieder
    + zwischen die Blumen, gegenüber dem Himmel. +

    +

    + — Rainer Maria Rilke +

    +

    A vision

    +

    + Two crowned Kings, and One that stood alone
    With no green weight of laurels round his head,
    But with sad eyes as one uncomforted,
    And wearied with man's never-ceasing moan
    For sins no bleating victim can atone,
    And sweet long lips with tears and kisses fed.
    Girt was he in a garment black and red,
    And at his feet I marked a broken stone
    Which sent up lilies, dove-like, to his knees.
    Now at their sight, my heart being lit with flame,
    I cried to Beatrice, 'Who are these? '
    And she made answer, knowing well each name,
    'AEschylos first, the second Sophokles,
    And last (wide stream of tears!) Euripides.' + +

    +

    + — Oscar Wilde +

    +

    Le dieu nu

    +

    + Il allait en silence au milieu des risées –
    + Il feignait d’être sourd à l’unanime affront –
    + Il souriait avec des lèvres défrisées –
    + Un bandeau noir ceignait les boucles de son front – +

    +

    + Et je lui demandai : « Jeune homme aux membres frêles
    + Es-tu l’amour ? » -- Alors il me répondit : Non !
    + Je marche en me cachant à l’ombre de ses ailes,
    + Et je suis le dieu nu qui ne dit pas son nom. +

    +

    + — Jean Cocteau +

    +
    + + diff --git a/src/pat/inject/inject.js b/src/pat/inject/inject.js index 886b7aa77..a877ed17b 100644 --- a/src/pat/inject/inject.js +++ b/src/pat/inject/inject.js @@ -34,6 +34,7 @@ define([ // XXX: this should not be here but the parser would bail on // unknown parameters and expand/collapsible need to pass the url // to us + parser.addArgument("scroll"); parser.addArgument("url"); var inject = { @@ -483,6 +484,18 @@ define([ } }); } + if (cfg.scroll) { + if (cfg['scroll'] == 'top') { + $(cfg['target'])[0].scrollTop = 0; + } else if (cfg['scroll'] == 'target') { + /* scrollable: target Target indicates the target in the URL fragment the URL + that's in the href or action in the case of a form. After injection, the + page or scroll container will scroll to bring the element with that ID into view. */ + /*$(cfg['target'])[0].scrollTop = $(cfg['selector'])[0].offsetTop;*/ + } else { + $(cfg['target'])[0].scrollTop = $(cfg['scroll'])[0].offsetTop; + } + } $el.trigger("pat-inject-success"); },