Are you first timer at lazacode.org? Why not join us and start exchange your knowledge with everyone. Register today!

Drupal - Add external JS

0 votes
5 views
added May 23 in Drupal by LC Marshal First Warrant Officer (9,130 points)
<?php
  // vue
  drupal_add_js(
    drupal_get_path('theme', 'markone') . "/assets/js/vendor/vue/vue.js",
      array('every_page' => true)
  );
  // lodash
  drupal_add_js(
    drupal_get_path('theme', 'markone') . "/assets/js/vendor/lodash/lodash.js",
      array('every_page' => true)
  );
  // vue resize
  drupal_add_js(
    drupal_get_path('theme', 'markone') . "/assets/js/vendor/vue-resize/dist/vue-resize.min.js",
      array('every_page' => true)
  );
  drupal_add_css(
    drupal_get_path('theme', 'markone') . "/assets/js/vendor/vue-resize/dist/vue-resize.css",
      array('every_page' => true)
  );
  // vue visible
  drupal_add_js(
    drupal_get_path('theme', 'markone') . "/assets/js/vendor/vue-visible/dist/v-visible.min.js",
      array('every_page' => true)
  );
  // vee-validate
  drupal_add_js(
    drupal_get_path('theme', 'markone') . "/assets/js/vendor/vee-validate/dist/vee-validate.min.js",
      array('every_page' => true)
  );
  // vue-slider-component
  drupal_add_js(
    drupal_get_path('theme', 'markone') . "/assets/js/vendor/vue-slider-component/dist/index.js",
      array('every_page' => true)
  );
  // deep diff
  drupal_add_js(
    drupal_get_path('theme', 'markone') . "/assets/js/vendor/deep-diff/deep-diff.min.js",
      array('every_page' => true)
  );
  // numeral
  drupal_add_js(
    drupal_get_path('theme', 'markone') . "/assets/js/vendor/numeral/numeral.min.js",
      array('every_page' => true)
  );
  // store.js
  drupal_add_js(
    drupal_get_path('theme', 'markone') . "/assets/js/vendor/store.js/dist/store.everything.min.js",
      array('every_page' => true)
  );
  // vue-clipboard
  drupal_add_js(
    drupal_get_path('theme', 'markone') . "/assets/js/vendor/vue-clipboard/vue-clipboard.min.js",
      array('every_page' => true)
  );

  drupal_add_js(
    "https://developers.google.com/maps/documentation/javascript/examples/markerclusterer/markerclusterer.js",
      array(
        'every_page' => true,
        'scope' => 'footer',
        'extenal' => true
      )
  );
  drupal_add_js(
    "https://maps.googleapis.com/maps/api/js?key=AIzaSyCeyYod74Cgj-8tc7hbA-kdoT9Uk8bMg84&libraries=places",
      array(
        'every_page' => true,
        'scope' => 'footer',
        'extenal' => true
      )
  );
  drupal_add_js(
    drupal_get_path('module', 'property_cs') . "/js/nanobar.min.js",
      array(
        'every_page' => true,
        'scope' => 'footer'
      )
  );
  drupal_add_js(
    drupal_get_path('module', 'property_cs') . "/js/jquery.timeago.js",
      array(
        'every_page' => true,
        'scope' => 'footer'
      )
  );

  // flickity
  drupal_add_js(
    drupal_get_path('theme', 'markone') . "/assets/js/vendor/flickity/flickity.pkgd.min.js",
      array('every_page' => true)
  );
  drupal_add_css(
    drupal_get_path('theme', 'markone') . "/assets/js/vendor/flickity/flickity.min.css",
      array('every_page' => true)
  );

  drupal_add_js(
    "https://cdn.jsdelivr.net/npm/es6-promise/dist/es6-promise.auto.js",
      array(
        'every_page' => true,
        'scope' => 'footer',
        'extenal' => true
      )
  );

  // echo '<pre>';
  // print_r($data);
  // exit;
  $queryString = explode('?', $_SERVER['REQUEST_URI']);
  $queryString = isset($queryString[1])?$queryString[1]:'';
?>

Please log in or register to response this reference.

lazacode.org - Malaysia based Knowledge Exchange Platform, where you can share your finding or solution with other members of community.
...