mirror of
https://gitlab.com/Oreolek/salet-module.git
synced 2024-06-16 23:20:54 +03:00
Renamed $ to jQuery for compatibility
This commit is contained in:
parent
d948536f64
commit
eb1f8df89a
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "salet",
|
||||
"version": "1.4.11",
|
||||
"version": "1.4.12",
|
||||
"description": "A general client-side framework for cybertext interactive fiction games.",
|
||||
"keywords": ["ifiction", "interactive fiction", "games", "coffee-script", "text", "menu"],
|
||||
"homepage": "http://salet.oreolek.ru",
|
||||
|
|
|
@ -16,7 +16,7 @@ class SaletView
|
|||
init: () =>
|
||||
jQuery("#page").on("click", "a", (event) ->
|
||||
event.preventDefault()
|
||||
a = $(this)
|
||||
a = jQuery(this)
|
||||
href = a.attr('href')
|
||||
if a.hasClass("once") || href.match(/[?&]once[=&]?/)
|
||||
salet.view.clearLinks(href)
|
||||
|
@ -51,15 +51,15 @@ class SaletView
|
|||
|
||||
# Scrolls the top of the screen to the specified point
|
||||
scrollTopTo: (value) ->
|
||||
$('html,body').animate({scrollTop: value}, 500)
|
||||
jQuery('html,body').animate({scrollTop: value}, 500)
|
||||
|
||||
# Scrolls the bottom of the screen to the specified point
|
||||
scrollBottomTo: (value) ->
|
||||
@scrollTopTo(value - $(window).height())
|
||||
@scrollTopTo(value - jQuery(window).height())
|
||||
|
||||
# Scrolls all the way to the bottom of the screen
|
||||
scrollToBottom: () ->
|
||||
@scrollTopTo($('html').height() - $(window).height());
|
||||
@scrollTopTo(jQuery('html').height() - jQuery(window).height());
|
||||
|
||||
###
|
||||
Removes all content from the page, clearing the main content area.
|
||||
|
@ -120,7 +120,7 @@ class SaletView
|
|||
clearLinks: (code) ->
|
||||
for a in jQuery("#page").find("a[href='" + code + "']")
|
||||
html = a.innerHTML
|
||||
a = $(a)
|
||||
a = jQuery(a)
|
||||
a.replaceWith(jQuery("<span>").addClass("ex_link").html(html))
|
||||
return true
|
||||
|
||||
|
@ -165,25 +165,25 @@ class SaletView
|
|||
|
||||
# Marks all links as old. This gets called in a `processLink` function.
|
||||
mark_all_links_old: () ->
|
||||
$('.new').removeClass('new')
|
||||
jQuery('.new').removeClass('new')
|
||||
|
||||
# Removes links and transient sections.
|
||||
# Arguments:
|
||||
# interactive - if we're working in interactive mode (or we're loading a save)
|
||||
removeTransient: (interactive = false) ->
|
||||
for a in $('#content').find('a')
|
||||
a = $(a)
|
||||
for a in jQuery('#content').find('a')
|
||||
a = jQuery(a)
|
||||
if (a.hasClass('sticky') || a.attr("href").match(/[?&]sticky[=&]?/))
|
||||
return
|
||||
a.replaceWith(jQuery("<span>").addClass("ex_link").html(a.html()))
|
||||
contentToHide = $('#content .transient, #content ul.options')
|
||||
contentToHide = jQuery('#content .transient, #content ul.options')
|
||||
contentToHide.add(jQuery("#content a").filter(() ->
|
||||
return $(this).attr("href").match(/[?&]transient[=&]?/)
|
||||
return jQuery(this).attr("href").match(/[?&]transient[=&]?/)
|
||||
))
|
||||
if (interactive)
|
||||
contentToHide.animate({opacity: 0}, 350).
|
||||
slideUp(500, () ->
|
||||
$(this).remove()
|
||||
jQuery(this).remove()
|
||||
)
|
||||
else
|
||||
contentToHide.remove()
|
||||
|
@ -191,9 +191,9 @@ class SaletView
|
|||
# At last, we scroll the view so that .new objects are in view.
|
||||
endOutputTransaction: () =>
|
||||
if !@interactive
|
||||
return; # We're loading a save; do nothing at all.
|
||||
$new = $('.new')
|
||||
viewHeight = $(window).height()
|
||||
return # We're loading a save; do nothing at all.
|
||||
$new = jQuery('.new')
|
||||
viewHeight = jQuery(window).height()
|
||||
newTop = newBottom = newHeight = optionHeight = 0
|
||||
|
||||
if $new.length == 0
|
||||
|
@ -206,8 +206,8 @@ class SaletView
|
|||
# We take the options list into account, because we don't want the new
|
||||
# content to scroll offscreen when the list disappears. So we calculate
|
||||
# scroll points as though the option list was already gone.
|
||||
if ($('.options').not('.new').length)
|
||||
optionHeight = $('.options').not('new').height()
|
||||
if (jQuery('.options').not('.new').length)
|
||||
optionHeight = jQuery('.options').not('new').height()
|
||||
|
||||
if (newHeight > (viewHeight - optionHeight - 50))
|
||||
# The new content is too long for our viewport, so we scroll the
|
||||
|
@ -215,7 +215,7 @@ class SaletView
|
|||
# height.
|
||||
scrollTopTo(newTop-(viewHeight*0.25) - optionHeight);
|
||||
else
|
||||
if (newTop > $('body').height() - viewHeight)
|
||||
if (newTop > jQuery('body').height() - viewHeight)
|
||||
# If we scroll right to the bottom, the new content will be in
|
||||
# view. So we do that.
|
||||
scrollToBottom();
|
||||
|
@ -234,7 +234,7 @@ class SaletView
|
|||
# Make option clicks pass through to their first link.
|
||||
link = jQuery("a", this)
|
||||
if (link.length > 0)
|
||||
$(link.get(0)).click()
|
||||
jQuery(link.get(0)).click()
|
||||
)
|
||||
|
||||
showBlock: (selector) ->
|
||||
|
|
Loading…
Reference in a new issue