I am integrating a platform with a browser based language switcher. I am planning to use Vuei18n for the language switcher because I am using Vue. But the thing is, there is an error showing unexpected identifier on both line 1 in my language.js and home.js. My scripts are in the same folder.
Here is my HTML code
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Sapphire | Home</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="robots" content="all,follow">
<link rel="stylesheet" href="vendor/bootstrap/css/bootstrap.min.css"> <!-- BOOTSTRAP FRAMEWORKS -->
<link rel="stylesheet" type="text/css" href="css/spinners.css"/> <!-- PRELOADER -->
<link rel="stylesheet" href="vendor/font-awesome/css/all.min.css"> <!-- FONTS -->
<link rel="stylesheet" type="text/css" href="css/style.css"/> <!-- CUSTOM STYLES -->
<link rel="shortcut icon" href="assets/images/static/favicon.ico"> <!-- WEB ICON -->
</head>
<body>
<!-- START OF VUE APP -->
<div id="app">
<!-- ================================ -->
<!-- HEADER/NAVBAR -->
<!-- ================================ -->
<ife-header disable-sidebar-toggle=true :change-language='changeLanguage'></ife-header>
<!-- ================================ -->
<!-- PAGE CONTENT -->
<!-- ================================ -->
<div class="row text-center ife-home">
<div class="p-1 col-6 col-md-4 col-lg-3" id="box1" >
<img src="assets/images/static/music.jpg" width="200px" alt="">
<div id="box2"><a class="clean-link" href="music.html"><i class="fas fa-4x fa-music box-icon"></i><p class="box-label text-white">{{ $t('hello') }}</p></a></div>
</div>
</div>
</div>
<!-- END OF VUE APP -->
<!-- ================================ -->
<!-- Scripts -->
<script src="vendor/jquery/jquery.min.js"></script>
<script src="vendor/jquery/jquery-confirm.js"></script>
<script src="vendor/popper.js/umd/popper.min.js"> </script>
<script src="vendor/bootstrap/js/bootstrap.min.js"></script>
<script src="vendor/lazy/jquery.lazy.min.js"></script>
<script src="vendor/vue/vue.min.js"></script>
<script src="js/components.js"></script>
<script src="vendor/vue/vue-i18n.js"></script>
<script src="js/language.js"></script>
<script src="js/home.js"></script>
</body>
</html>
Here is my Vuejs code or home.js
import Vue from "vue"
import { i18n } from './language.js'
var app = new Vue({
el:'#app',
router,
i18n,
render: (h) => h(App)
})
Here is my Vuei18n code or language.js
import Vue from 'vue'
import VueI18n from 'vue-i18n'
Vue.use(VueI18n)
export const i18n = new VueI18n({
locale: 'en', //set locale
fallbackLocale: 'en',
messages: { en: { hello: 'Hello'}, bg: { hello: '3apeben' } } //set locale message
})
"I expect the output Hello but it displays {{ $t('hello') }}"
Related
and greetings. I'm trying to get converse to work in embedded mode, so there is a 'full screen' version that doesn't take up the entire page. I'm having issues, where the converse control box grows outside of the area I've assigned, but there is no scroll bar to view it.
I've tried a lot of things, setting dimensions, width and height, changing dimensions, and it doesn't fix the issue. I was wondering if someone could tell me what I'm doing wrong. The webpage code is listed below.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="description" content="">
<meta name="author" content="">
<!-- Custom fonts for this template-->
<link href="/vendor/fontawesome-free/css/all.min.css" rel="stylesheet" type="text/css">
<link href="https://fonts.googleapis.com/css?family=Nunito:200,200i,300,300i,400,400i,600,600i,700,700i,800,800i,900,900i" rel="stylesheet">
<!-- Custom styles for this template-->
<link href="/css/sb-admin-2.min.css" rel="stylesheet">
<link href="/css/PEC_global.css" rel="stylesheet">
<link rel="stylesheet" type="text/css" media="screen" href="https://cdn.conversejs.org/9.0.0/dist/converse.css">
<script src="https://cdn.conversejs.org/9.0.0/dist/converse.js" charset="utf-8"></script>
<!--script src="/vendor/converse/dist/converse.js"></script-->
<script src="/vendor/jquery/jquery.min.js"></script>
<script src="https://cdn.conversejs.org/3rdparty/libsignal-protocol.min.js"></script>
<style>
.converse-container {
height: 80vh;
}
</style>
</head>
<body id="page-top">
<!-- Page Wrapper -->
<div id="wrapper" style="height:100vh;">
<!-- Sidebar -->
<?php require($_SERVER["DOCUMENT_ROOT"] . '/navBar.php'); ?>
<!-- Content Wrapper -->
<div id="content-wrapper" class="d-flex flex-column">
<div class="row">
<div class="col-9">
<div class="converse-container">
<converse-root></converse-root>
</div>
</div>
</div>
<!-- /.container-fluid -->
</div>
<!-- End of Main Content -->
<!-- Footer -->
<!-- End of Footer -->
</div>
<!-- End of Content Wrapper -->
<!-- Scroll to Top Button-->
<a class="scroll-to-top rounded" href="#page-top">
<i class="fas fa-angle-up"></i>
</a>
<!-- Logout Modal-->
<!-- Bootstrap core JavaScript-->
<script src="/vendor/jquery/jquery.min.js"></script>
<script src="/vendor/bootstrap/js/bootstrap.bundle.min.js"></script>
<!-- Core plugin JavaScript-->
<script src="/vendor/jquery-easing/jquery.easing.min.js"></script>
<!-- Custom scripts for all pages-->
<script src="/js/sb-admin-2.min.js"></script>
<!-- custom JS for PEC -->
<script src="/js/PEC.js"></script>
</body>
<script>
var tabulatorTable = null;
$(document).ready(function() {
converse.initialize({
default_domain: "XXXXXXX",
bosh_service_url: 'XXXXXXXXX',
view_mode: 'embedded',
message_archiving: 'always',
auto_login: true,
auto_reconnect: true,
credentials_url: 'XXXXXX',
clear_cache_on_logout: true,
notify_all_room_messages: true,
play_sounds: true,
allow_contact_removal: false,
//allow_logout: false,
allow_muc_invitations: false,
allow_registration: false,
allow_contact_requests: false,
send_chat_state_notifications: false,
//blacklisted_plugins: ['converse-fullscreen'],
});
});
</script>
I have an index.html file that is getting data from app.py (pulling from MongoDB) using render_template and I am attempting to read the data loaded in the index.html into my logic.js so I can create a leaflet map. However, it seems that the data is not loading in my logic.js. Any thoughts?
Here is my index.html:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Visualization</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap#5.1.3/dist/css/bootstrap.min.css" rel="stylesheet"
integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous">
<!-- Leaflet CSS -->
<link rel="stylesheet" href="https://unpkg.com/leaflet#1.6.0/dist/leaflet.css"
integrity="sha512-xwE/Az9zrjBIphAcBb3F6JVqxf46+CDLwfLMHloNu6KEQCAWi6HcDUbeOfBIptF7tcCzusKFjFw2yuvEpDL9wQ=="
crossorigin="" />
<!-- Leaflet JavaScript code -->
<script src="https://unpkg.com/leaflet#1.6.0/dist/leaflet.js"
integrity="sha512-gZwIG9x3wUXg2hdXF6+rVkLF/0Vi9U8D2Ntg4Ga5I5BZpVkVxlJWbSQtXPSiUTtC0TjtGOmxa1AJPuV0CPthew=="
crossorigin=""></script>
<!-- Our CSS -->
<link rel="stylesheet" type="text/css" href="/static/css/style.css">
</head>
<body>
<div id="map"></div>
<div class="container text-center">
<h1 class="p-3 mb-2 bg-secondary text-white">Map Visualization</h1>
</div>
<!-- confirm that data is loaded -->
<!-- {% for i in html_results %}
<h5>{{i}}</h5>
{%endfor%} -->
<script>
let html_results = JSON.parse("{{html_results | tojson | safe}}")
</script>
<script src="{{url_for('static', filename='/js/logic.js')}}"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap#5.1.3/dist/js/bootstrap.bundle.min.js"
integrity="sha384-ka7Sk0Gln4gmtz2MlQnikT1wXgYsOg+OMhuP+IlRH9sENBO0LRn5q+8nbTov4+1p"
crossorigin="anonymous"></script>
</body>
</html>
I'm locked into a jQuery ui issue. I have done a form that I need to autocomplete all the field based on client id. It is like if I'm typing the id of an existing client, all the fields should be autofill with all that's client values from database table like fisrtname , last name, address, date-of-birth, but for the first i'm just trying to test if jquery Ui is working and I got the "$(...).autocomplete is not a function" error in console. It is not from Jquery because I have done also a notification system and i dysplay all notification with Jquery and it is working , I think That it's from jQuery UI. I have tried all possible solutions that I found with no success. Thank's in advance ! Good day to everybody! :)
This is My layouts.app
<!doctype html>
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="author" content="">
<!-- CSRF Token -->
<meta name="csrf-token" content="{{ csrf_token() }}">
<meta name="userId" content="{{Auth::check() ? Auth::user()->id : '' }}">
<!-- Scripts -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script src="{{asset('jqueryui/jquery-ui.min.js')}}" type="text/javascript"></script>
<script>
window.Laravel = {!! json_encode([
'csrfToken' => csrf_token(),
]); !!}
</script>
<!-- Fonts -->
{{-- <link rel="dns-prefetch" href="//fonts.gstatic.com">
<link href="https://fonts.googleapis.com/css?family=Nunito" rel="stylesheet"> --}}
<!-- Styles -->
<link rel="stylesheet" type="text/css" href="{{asset('jqueryui/jquery-ui.min.css')}}">
<link rel="icon" type="image/png" sizes="16x16" href="{{asset('assets/images/favicon.png')}}">
<title>S.C. Amanet Stefany IFN S.R.L.</title>
<!-- Bootstrap Core CSS -->
<link href="{{asset('assets/plugins/bootstrap/css/bootstrap.min.css')}}" rel="stylesheet">
<!-- morris CSS -->
<link href="{{asset('assets/plugins/morrisjs/morris.css')}}" rel="stylesheet">
<!-- Custom CSS -->
<link href="{{asset('css/style.css')}}" rel="stylesheet">
<!-- You can change the theme colors from here -->
<link href="{{asset('css/colors/blue.css')}}" id="theme" rel="stylesheet">
{{-- <link href="{{ asset('css/app.css') }}" rel="stylesheet"> --}}
</head>
<body>
.... this is my content ....
<!-- Scripts -->
<script src="{{ asset('js/app.js') }}" defer></script>
<script src="{{ asset('js/app.js') }}"></script>
{{-- <script src="{{asset('assets/plugins/jquery/jquery.min.js')}}"></script> --}}
{{-- <script src="{{asset('js/jquery.js')}}"></script> --}}
<!-- Bootstrap tether Core JavaScript -->
<script src="{{asset('assets/plugins/bootstrap/js/popper.min.js')}}"></script>
<script src="{{asset('assets/plugins/bootstrap/js/bootstrap.min.js')}}"></script>
<!-- slimscrollbar scrollbar JavaScript -->
<script src="{{asset('js/jquery.slimscroll.js')}}"></script>
<!--Wave Effects -->
<script src="{{asset('js/waves.js')}}"></script>
<!--Menu sidebar -->
<script src="{{asset('js/sidebarmenu.js')}}"></script>
<!--stickey kit -->
<script src="{{asset('assets/plugins/sticky-kit-master/dist/sticky-kit.min.js')}}"></script>
<!--Custom JavaScript -->
{{-- <script src="{{asset('js/custom.js')}}"></script> --}}
<script src="{{asset('js/custom.min.js')}}"></script>
{{-- <script src="{{asset('js/jquery-ui.js')}}"></script> --}}
<!-- ============================================================== -->
<!-- This page plugins -->
<!-- ============================================================== -->
<!--sparkline JavaScript -->
<script src="{{asset('assets/plugins/sparkline/jquery.sparkline.min.js')}}"></script>
<!--morris JavaScript -->
<script src="{{asset('assets/plugins/raphael/raphael-min.js')}}"></script>
<script src="{{asset('assets/plugins/morrisjs/morris.min.js')}}"></script>
<!-- Chart JS -->
<script src="{{asset('js/dashboard1.js')}}"></script>
<!-- ============================================================== -->
<!-- Style switcher -->
<!-- ============================================================== -->
<script src="{{asset('assets/plugins/styleswitcher/jQuery.style.switcher.js')}}"></script>
</body>
</html>
This is my view with that form
<div class="form-group row ml-1 mb-1">
<label for="example-text-input" class="col-3 col-form-label pt-0" style="min-width: 80px;">Serie B.I./C.I.:</label>
<div class="col-3 pl-0">
<input class="form-control input-height pl-1 pr-1" name="serie" type="text" value="" id="">
</div>
<div class="col-4 pl-0">
<input class="form-control input-height pl-1 pr-1" name="nr_id" type="text" value="" id="cltId" > //this #cltId ----------
</div>
</div>
And this is my resource/js/app.js with the jQuery code that I need
$(document).ready(function(){
$("#cltId").autocomplete({
source: [
'Apple',
'Banana',
'Orange',
]
});
});
Any suggestion ? Have I added something that I shouldn't ? Have I write the code in wrong way ? I can not find the mistake ,any answer will help me lot.
Finally solved, I have moved all the jQuery code in app.js, I have run the command
npm install jquery-ui --save-dev
and I imported it in app.js like :
import $ from 'jquery';
window.$ = window.jQuery = $;
import 'jquery-ui/ui/widgets/autocomplete.js';
IMPORTANT ! note that the autocomplete.js from the ends is work for me because is the widget that I want to use , find out what widget you want and import it there after importing jquery :
Import 'jquery-ui/widgets/here is the widget that you want .js'
But before look to not import jquery anywhere else like layouts or any other js files like bootstrap.js for example.
I'm setting up a config for the 'angular-oauth2' module, and when I run
angular.module('', ['angular-oauth2'])
.config(['OAuthProvider', function(OAuthProvider) {
OAuthProvider.configure({
baseUrl: '/api/v1',
clientId: null,
clientSecret: null // optional
});
}]);
my server runs fine and all is well, when I add the name of the app though ('fuse') it breaks:
angular.module('fuse', ['angular-oauth2'])
.config(['OAuthProvider', function(OAuthProvider) {
OAuthProvider.configure({
baseUrl: '/api/v1',
clientId: null,
clientSecret: null // optional
});
}]);
And I get this error in the console:
angular.js:38 Uncaught Error: [$injector:modulerr] http://errors.angularjs.org/1.5.5/$injector/modulerr?p0=fuse&p1=Error%3A%20…ogleapis.com%2Fajax%2Flibs%2Fangularjs%2F1.5.5%2Fangular.min.js%3A43%3A246)
I've looked in the html and low and behold the name of the app is 'fuse', so what's up with this error?
<html>
<head>
<base href="/app/">
<meta charset="utf-8">
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<title></title>
<link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/angular_material/0.11.2/angular-material.min.css">
<link rel="stylesheet" href="build/fuse.css" >
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous">
<script src="//ajax.googleapis.com/ajax/libs/jquery/2.2.3/jquery.min.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.5.5/angular.min.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.5.5/angular-animate.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/angular_material/1.0.7/angular-material.min.js"></script>
<script src="build/fuse.js"></script>
</head>
<!--[if lt IE 10]>
<p class="browsehappy">You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade
your browser</a> to improve your experience.</p>
<![endif]-->
<body ng-app="fuse" md-theme="default" md-theme-watch
class="{{state.current.bodyClass || ''}}">
<!-- SPLASH SCREEN -->
<ms-splash-screen id="splash-screen" >
<div class="center">
<div class="logo">
<span></span>
</div>
<!-- Material Design Spinner -->
<div class="spinner-wrapper">
<div class="spinner">
<div class="inner">
<div class="gap"></div>
<div class="left">
<div class="half-circle"></div>
</div>
<div class="right">
<div class="half-circle"></div>
</div>
</div>
</div>
</div>
<!-- / Material Design Spinner -->
</div>
</ms-splash-screen>
<!-- / SPLASH SCREEN -->
<div id="main" class="animate-slide-up scrollable" ui-view="main" layout="column" ></div>
<floating-app-version></floating-app-version>
<!--<link href="build/styles.css" type="text/css" rel="stylesheet" />-->
<script src="build/common.js"></script>
<script src="build/vendor.js"></script>
<script src="/assets/app_config.js"></script>
<link rel="stylesheet" href="build/app.css" lazyload>
<script src="build/app.js"></script>
<script src="build/style.js"></script>
</body>
</html>
When I try to run the following code in Laravel with vue.js:
<html>
<head>
<title></title>
<link href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.min.css" rel="stylesheet">
<!-- Include roboto.css to use the Roboto web font, material.css to include the theme and ripples.css to style the ripple effect -->
<link href="/css/roboto.min.css" rel="stylesheet">
<link href="/css/material.min.css" rel="stylesheet">
<link href="/css/ripples.min.css" rel="stylesheet">
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body>
<div class="container col-md-8 col-md-offset-2">
<div class="panel panel-default">
<div class="panel-heading">
<h2> Locaties </h2>
</div>
<data list="{{ json_encode($locations) }}"></data>
</div>
</div>
<template id="ln-data">
<ul>
<li v-for="item in list">#{{ item.name }}</li>
</ul>
</template>
<script>
new Vue({
el: 'body'
})
Vue.component('data', {
template: '#ln-data',
props:['list']
})
</script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/1.0.16/vue.common.js"></script>
<script src="//code.jquery.com/jquery-1.10.2.min.js"></script>
<script src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.2/js/bootstrap.min.js"></script>
<script src="/js/ripples.min.js"></script>
<script src="/js/material.min.js"></script>
<style>
.newclient {
display:none;
}
</style>
</body>
</html>
I receive the following errors in the console:
Uncaught ReferenceError: process is not defined(anonymous function) #
vue.common.js:981 vue.common.js:9157 Uncaught TypeError: this._init is
not a function
What am I doing wrong?
Try this:
Changes to your version:
vue.js imported instead of vue.common.js
moved your own <script>...</script to the bottom of the imports because it depends on the vue.js import
activate the vue debug mode while developping makes it easier to find errors.
<html>
<head>
<meta charset="UTF-8">
<title></title>
<link href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.min.css" rel="stylesheet">
<!-- Include roboto.css to use the Roboto web font, material.css to include the theme and ripples.css to style the ripple effect -->
<link href="/css/roboto.min.css" rel="stylesheet">
<link href="/css/material.min.css" rel="stylesheet">
<link href="/css/ripples.min.css" rel="stylesheet">
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body>
<div class="container col-md-8 col-md-offset-2">
<div class="panel panel-default">
<div class="panel-heading">
<h2> Locaties </h2>
</div>
<data list="{{ json_encode($locations) }}"></data>
</div>
</div>
<template id="ln-data">
<ul>
<li v-for="item in list">#{{ item.name }}</li>
</ul>
</template>
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/1.0.16/vue.js"></script>
<script src="//code.jquery.com/jquery-1.10.2.min.js"></script>
<script src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.2/js/bootstrap.min.js"></script>
<script src="/js/ripples.min.js"></script>
<script src="/js/material.min.js"></script>
<script>
// vuejs debug mode
Vue.config.debug = true; //TODO: Remove in production
new Vue({
el: 'body'
})
Vue.component('data', {
template: '#ln-data',
props:['list']
})
</script>
<style>
.newclient {
display:none;
}
</style>
</body>
</html>