コード例 #1
0
ファイル: main.js プロジェクト: fardog/textcomplete
import Textcomplete from '../textcomplete';
import Textarea from '../textarea';
import hljs from 'highlight.js';

global.Textarea = Textarea;
global.Textcomplete = Textcomplete;

hljs.initHighlightingOnLoad();

function initializeTextcompletes() {
  let els = document.getElementsByClassName('auto-eval');
  for (let i = 0, l = els.length; i < l; i++) {
    let el = els[i];
    eval(`(function () {${el.innerText || el.textContent}})()`);
  }
}

function runDemo() {
  ['textarea1', 'textarea2', 'textarea3'].forEach(id => {
    let textarea = document.getElementById(id);
    textarea.selectionStart = textarea.selectionEnd = textarea.value.length;
    let event = new Event('input', {
      bubbles: true,
      cancelable: true,
    });
    event.keyCode = 65;
    textarea.dispatchEvent(event);
  });

  document.getElementById('textarea1').focus();
}
コード例 #2
0
ファイル: docs.js プロジェクト: nuxeo/doc.nuxeo.com
$(document).ready(function() {
  require('./modules/polyfills');
  var menu = require('./modules/left_menu');
  var menu_height = require('./modules/left_menu_height');
  var menu_filter = require('./modules/left_menu_filter');
  var satellite_header = require('./satellite_header');

  // Tabbed page
  require('./tabbed');

  // Menu
  if ($('#side_menu').find('div').length) {
    menu_height($);
    menu($);

    // Menu filtering
    menu_filter($);

    // In page TOC
    require('./modules/toc');
  }

  $(document).foundation();

  require('./modules/list_span');

  // Rainbow menu - enable open and close
  var $rainbow_menu = $('#doc-main-menu');
  $('#nuxeo-satellite-header')
    .find('.rainbow-menu')
    .hover(
      function() {
        $rainbow_menu.addClass('active');
      },
      function() {
        $rainbow_menu.removeClass('active');
      }
    );

  // Style codeblocks
  var hljs = require('highlight.js');
  hljs.initHighlightingOnLoad();

  // Add copy icon to codeblocks
  require('./modules/copy_code');

  // Add copy shortlink functionality
  require('./modules/copy_shortlink');

  // Add Keyboard shortcuts
  require('./modules/keyboard_shortcuts');

  // satellite_header
  satellite_header($);

  // menu search
  require('./modules/menu_search');

  // Prodpad Feedback
  require('./modules/prodpad');
});
コード例 #3
0
(function () {
  'use strict';

  // include index.html for webpack to load
  require('./index.html');

  import(/* webpackPrefetch: true */ 'reveal.js/css/reveal.css');
  import(/* webpackPrefetch: true */ 'reveal.js/css/theme/night.css');
  import(/* webpackPrefetch: true */ 'reveal.js/lib/css/monokai.css'); // for code colors

  var hljs = require('highlight.js');

  Reveal.initialize({
    // Display presentation control arrows
    controls: true,

    // Help the user learn the controls by providing hints, for example by
    // bouncing the down arrow when they first encounter a vertical slide
    controlsTutorial: true,

    // Determines where controls appear, "edges" or "bottom-right"
    controlsLayout: 'bottom-right',

    // Visibility rule for backwards navigation arrows; "faded", "hidden"
    // or "visible"
    controlsBackArrows: 'faded',

    // Display a presentation progress bar
    progress: true,

    // Display the page number of the current slide
    slideNumber: false,

    // Add the current slide number to the URL hash so that reloading the
    // page/copying the URL will return you to the same slide
    hash: false,

    // Push each slide change to the browser history. Implies `hash: true`
    history: false,

    // Enable keyboard shortcuts for navigation
    keyboard: true,

    // Enable the slide overview mode
    overview: true,

    // Vertical centering of slides
    center: true,

    // Enables touch navigation on devices with touch input
    touch: true,

    // Loop the presentation
    loop: false,

    // Change the presentation direction to be RTL
    rtl: false,

    // See https://github.com/hakimel/reveal.js/#navigation-mode
    navigationMode: 'default',

    // Randomizes the order of slides each time the presentation loads
    shuffle: false,

    // Turns fragments on and off globally
    fragments: true,

    // Flags whether to include the current fragment in the URL,
    // so that reloading brings you to the same fragment position
    fragmentInURL: false,

    // Flags if the presentation is running in an embedded mode,
    // i.e. contained within a limited portion of the screen
    embedded: false,

    // Flags if we should show a help overlay when the questionmark
    // key is pressed
    help: true,

    // Flags if speaker notes should be visible to all viewers
    showNotes: false,

    // Global override for autoplaying embedded media (video/audio/iframe)
    // - null: Media will only autoplay if data-autoplay is present
    // - true: All media will autoplay, regardless of individual setting
    // - false: No media will autoplay, regardless of individual setting
    autoPlayMedia: null,

    // Global override for preloading lazy-loaded iframes
    // - null: Iframes with data-src AND data-preload will be loaded when within
    //   the viewDistance, iframes with only data-src will be loaded when visible
    // - true: All iframes with data-src will be loaded when within the viewDistance
    // - false: All iframes with data-src will be loaded only when visible
    preloadIframes: null,

    // Number of milliseconds between automatically proceeding to the
    // next slide, disabled when set to 0, this value can be overwritten
    // by using a data-autoslide attribute on your slides
    autoSlide: 0,

    // Stop auto-sliding after user input
    autoSlideStoppable: true,

    // Use this method for navigation when auto-sliding
    autoSlideMethod: Reveal.navigateNext,

    // Specify the average time in seconds that you think you will spend
    // presenting each slide. This is used to show a pacing timer in the
    // speaker view
    defaultTiming: 120,

    // Enable slide navigation via mouse wheel
    mouseWheel: false,

    // Hide cursor if inactive
    hideInactiveCursor: true,

    // Time before the cursor is hidden (in ms)
    hideCursorTime: 5000,

    // Hides the address bar on mobile devices
    hideAddressBar: true,

    // Opens links in an iframe preview overlay
    // Add `data-preview-link` and `data-preview-link="false"` to customise each link
    // individually
    previewLinks: false,

    // Transition style
    transition: 'slide', // none/fade/slide/convex/concave/zoom

    // Transition speed
    transitionSpeed: 'default', // default/fast/slow

    // Transition style for full page slide backgrounds
    backgroundTransition: 'fade', // none/fade/slide/convex/concave/zoom

    // Number of slides away from the current that are visible
    viewDistance: 3,

    // Parallax background image
    parallaxBackgroundImage: '', // e.g. "'https://s3.amazonaws.com/hakim-static/reveal-js/reveal-parallax-1.jpg'"

    // Parallax background size
    parallaxBackgroundSize: '', // CSS syntax, e.g. "2100px 900px"

    // Number of pixels to move the parallax background per slide
    // - Calculated automatically unless specified
    // - Set to 0 to disable movement along an axis
    parallaxBackgroundHorizontal: null,
    parallaxBackgroundVertical: null,

    // The display mode that will be used to show slides
    display: 'block',

    // optional dependencies
    dependencies: [
      // TODO: plugin borked, workaround is to use hljs directly
     // { src: require('reveal.js/plugin/highlight/highlight.js'), async: true }, // code highlighting
      { src: require('reveal.js/plugin/notes/notes.js'), async: true },
      { src: require('reveal.js/plugin/zoom-js/zoom.js'), async: true }
    ]
  });

  // NOTE: The highlight plugin above is not working, so load highlight.js directly
  hljs.initHighlightingOnLoad();
})();
コード例 #4
0
var Reveal = require('reveal.js');
var RevealCSS = require('reveal.js/css/reveal.css');
var RevealCSS = require('reveal.js/css/theme/moon.css');

var highlightJs = require('highlight.js');
var highlightJsCss = require('highlight.js/styles/default.css');
highlightJs.initHighlightingOnLoad();

require('../css/index.css');

Reveal.initialize({
	viewDistance: 2
});


var slideCount;
Reveal.addEventListener('ready', (event) => {
	slideCount = document.querySelectorAll('section').length;
	updateFooter(event.indexh);
});


Reveal.addEventListener('slidechanged', (event) => {
	location.hash = `#/${event.indexh}/${event.indexv}`;
	updateFooter(event.indexh);
});

function updateFooter(currentSlide) {
	if (currentSlide === 0 || currentSlide === (slideCount - 1)) {
		document.querySelector('footer').classList.remove('visible');
	} else {
コード例 #5
0
ファイル: app.js プロジェクト: nullobject/jsdoc-react
require('./style.less')

const hl = require('highlight.js')

hl.initHighlightingOnLoad()