Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
D
douban-api-proxy
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
captainwong
douban-api-proxy
Commits
33a0a4c1
Commit
33a0a4c1
authored
Jan 31, 2021
by
Ozzie Isaacs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Changed function for getting path in js file
parent
eeb7974e
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
20 deletions
+15
-20
edit_books.js
cps/static/js/edit_books.js
+2
-2
main.js
cps/static/js/main.js
+12
-16
admin.html
cps/templates/admin.html
+1
-2
No files found.
cps/static/js/edit_books.js
View file @
33a0a4c1
...
...
@@ -78,10 +78,10 @@ function prefixedSource(prefix, query, cb, bhAdapter) {
});
}
function
getPath
()
{
/*
function getPath() {
var jsFileLocation = $("script[src*=edit_books]").attr("src"); // the js file path
return jsFileLocation.substr(0, jsFileLocation.search("/static/js/edit_books.js")); // the js folder path
}
}
*/
var
authors
=
new
Bloodhound
({
name
:
"authors"
,
...
...
cps/static/js/main.js
View file @
33a0a4c1
...
...
@@ -15,6 +15,11 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
function
getPath
()
{
var
jsFileLocation
=
$
(
"script[src*=jquery]"
).
attr
(
"src"
);
// the js file path
return
jsFileLocation
.
substr
(
0
,
jsFileLocation
.
search
(
"/static/js/libs/jquery.min.js"
));
// the js folder path
}
// Generic control/related handler to show/hide fields based on a checkbox' value
// e.g.
// <input type="checkbox" data-control="stuff-to-show">
...
...
@@ -110,15 +115,13 @@ $(document).ready(function() {
});
function
ConfirmDialog
(
id
,
dataValue
,
yesFn
,
noFn
)
{
var
pathname
=
document
.
getElementsByTagName
(
"script"
),
src
=
pathname
[
pathname
.
length
-
1
].
src
;
var
path
=
src
.
substring
(
0
,
src
.
lastIndexOf
(
"/"
));
var
$confirm
=
$
(
"#GeneralDeleteModal"
);
// var dataValue= e.data('value'); // target.data('value');
$confirm
.
modal
(
'show'
);
$
.
ajax
({
method
:
"get"
,
dataType
:
"json"
,
url
:
path
+
"/../..
/ajax/loaddialogtexts/"
+
id
,
url
:
getPath
()
+
"
/ajax/loaddialogtexts/"
+
id
,
success
:
function
success
(
data
)
{
$
(
"#header"
).
html
(
data
.
header
);
$
(
"#text"
).
html
(
data
.
main
);
...
...
@@ -140,15 +143,13 @@ function ConfirmDialog(id, dataValue, yesFn, noFn) {
$
(
"#delete_confirm"
).
click
(
function
()
{
//get data-id attribute of the clicked element
var
pathname
=
document
.
getElementsByTagName
(
"script"
),
src
=
pathname
[
pathname
.
length
-
1
].
src
;
var
path
=
src
.
substring
(
0
,
src
.
lastIndexOf
(
"/"
));
var
deleteId
=
$
(
this
).
data
(
"delete-id"
);
var
bookFormat
=
$
(
this
).
data
(
"delete-format"
);
if
(
bookFormat
)
{
window
.
location
.
href
=
path
+
"/../..
/delete/"
+
deleteId
+
"/"
+
bookFormat
;
window
.
location
.
href
=
getPath
()
+
"
/delete/"
+
deleteId
+
"/"
+
bookFormat
;
}
else
{
if
(
$
(
this
).
data
(
"delete-format"
))
{
path
=
path
+
"/../..
/ajax/delete/"
+
deleteId
;
path
=
getPath
()
+
"
/ajax/delete/"
+
deleteId
;
$
.
ajax
({
method
:
"get"
,
url
:
path
,
...
...
@@ -168,7 +169,7 @@ $("#delete_confirm").click(function() {
}
});
}
else
{
window
.
location
.
href
=
path
+
"/../..
/delete/"
+
deleteId
;
window
.
location
.
href
=
getPath
()
+
"
/delete/"
+
deleteId
;
}
}
...
...
@@ -224,7 +225,7 @@ $(function() {
function
updateTimer
()
{
$
.
ajax
({
dataType
:
"json"
,
url
:
window
.
location
.
pathname
+
"/
../../
get_updater_status"
,
url
:
window
.
location
.
pathname
+
"/get_updater_status"
,
success
:
function
success
(
data
)
{
// console.log(data.status);
$
(
"#DialogContent"
).
html
(
updateText
[
data
.
status
]);
...
...
@@ -484,12 +485,9 @@ $(function() {
$
(
this
).
attr
(
'id'
),
$
(
this
).
data
(
'value'
),
function
(
value
)
{
var
pathname
=
document
.
getElementsByTagName
(
"script"
);
var
src
=
pathname
[
pathname
.
length
-
1
].
src
;
var
path
=
src
.
substring
(
0
,
src
.
lastIndexOf
(
"/"
));
$
.
ajax
({
method
:
"get"
,
url
:
path
+
"/../..
/kobo_auth/deleteauthtoken/"
+
value
,
url
:
getPath
()
+
"
/kobo_auth/deleteauthtoken/"
+
value
,
});
$
(
"#config_delete_kobo_token"
).
hide
();
}
...
...
@@ -582,12 +580,10 @@ $(function() {
$
(
"#DialogFinished"
).
addClass
(
"hidden"
);
$
(
"#DialogContent"
).
html
(
""
);
$
(
"#spinner2"
).
show
();
var
pathname
=
document
.
getElementsByTagName
(
"script"
),
src
=
pathname
[
pathname
.
length
-
1
].
src
;
var
path
=
src
.
substring
(
0
,
src
.
lastIndexOf
(
"/"
));
$
.
ajax
({
method
:
"get"
,
dataType
:
"json"
,
url
:
path
+
"/../..
/import_ldap_users"
,
url
:
getPath
()
+
"
/import_ldap_users"
,
success
:
function
success
(
data
)
{
$
(
"#spinner2"
).
hide
();
$
(
"#DialogContent"
).
html
(
data
.
text
);
...
...
cps/templates/admin.html
View file @
33a0a4c1
...
...
@@ -42,9 +42,8 @@
{% endif %}
{% endfor %}
</table>
{% else %}
<div
class=
"btn btn-default"
id=
"admin_user_table"
><a
href=
"{{url_for('admin.edit_user_table')}}"
>
{{_('Edit Users')}}
</a></div>
{% endif %}
<div
class=
"btn btn-default"
id=
"admin_user_table"
><a
href=
"{{url_for('admin.edit_user_table')}}"
>
{{_('Edit Users')}}
</a></div>
<div
class=
"btn btn-default"
id=
"admin_new_user"
><a
href=
"{{url_for('admin.new_user')}}"
>
{{_('Add New User')}}
</a></div>
{% if (config.config_login_type == 1) %}
<div
class=
"btn btn-default"
id=
"import_ldap_users"
data-toggle=
"modal"
data-target=
"#StatusDialog"
>
{{_('Import LDAP Users')}}
</div>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment